#1492 new
David Shepherdson

Inline image attachments displayed upside-down (sometimes)

Reported by David Shepherdson | July 10th, 2016 @ 07:10 AM

Sometimes I receive e-mail messages with images attached, and these images are displayed inline in (or at the end of) the message as expected. However, sometimes these images are displayed upside-down! Using Quick Look to view the images, or opening them in Preview, they're the right way up; it's only the inline display within MailMate that's showing them upside-down.

From a (very) little bit of investigation, at least one case that seems to be triggering this (and maybe it's the only one?) is when both the message and the images were sent from and taken on an iPhone, and the images display orientation flag information in the Preview info window (such as 'Orientation: 3 (Rotated 180°)'). I wonder whether this means the library MailMate's using to display the images inline is unaware of (or not respecting) this flag?

This is hardly urgent by any means, but I thought it worth reporting in case it turns out to be easy to fix.

Comments and changes to this ticket

  • benny

    benny August 10th, 2016 @ 01:50 PM

    I've fought this issue in the past, but I thought it worked now due to OS updates. Which version of OS X are you using now?

  • David Shepherdson

    David Shepherdson August 11th, 2016 @ 09:22 AM

    I'm on 10.11.6, unfortunately... So unless it's fixed in 10.12? :-)

  • benny

    benny August 11th, 2016 @ 02:13 PM

    • State changed from “new” to “cantreproduce”

    :( MailMate just uses a webview (like the one used in Safari) and relies on that to make the correct orientation. You can send me an example email via “Help ▸ Send Feedback” if you like, but I'm afraid it's not easily fixed (I don't really know).

  • David Shepherdson

    David Shepherdson August 21st, 2016 @ 07:15 AM

    Yeah, I had assumed it must be something like that. Having done a little bit more experimentation, if I open one of these images directly in Safari (or Firefox, just for a point of comparison), it's displayed in the 'correct' orientation; however, if I make a simple HTML page with an image tag pointing to the same image file, and load this page in the browser (either one), then the image appears with the 'wrong' orientation.

    So this is clearly not just MailMate's fault! I'll see if I might be able to raise a bug on the WebKit side (and Mozilla, for that matter), since I have a nice simple reproducible test case. Maybe if they fix it there, at some point in the future, the fix will make its way to MailMate too!

  • David Shepherdson

    David Shepherdson August 21st, 2016 @ 07:49 AM

    And having done a bit more investigation in readiness for raising a bug with WebKit, it seems this is an existing, known issue, and has been for years... :-(

    There's a long discussion on the topic as part of WebKit bug 19688, which seems to end up with an indication that something was implemented back in 2012, but not turned on by default? It seems like there's meant to be a setting for WebKitShouldRespectImageOrientation, but when I try this via defaults write for either MailMate or Safari, it has no effect on the inline images.

    There's also apparently a CSS property to make this work, via image-orientation: from-image; this was implemented in Firefox in 2013, and sure enough adding that style to my HTML test page makes it work in Firefox, but no other rendering engines support it at present, as far as I can tell.

    (And just to confuse things further, iOS WebKit renders images this way by default, in contrast with the Desktop version, according to the CanIUse listing.)

    So, unless they implement the image-orientation support in WebKit as per WebKit bug 89052, it doesn't look like there's anything MailMate can do about this sort of problem.

    (I just thought it worth noting all this down here for future reference, and for anybody else who might come across the same problem.)

  • benny

    benny August 21st, 2016 @ 10:57 AM

    Thanks for the investigation. Could you try creating the following path and file:

    /Users/<username>/Library/Application\ Support/MailMate/Resources/MmMessagesWebView/html_stylesheet.css
    

    It should have this content:

    img {  
        image-orientation: from-image;
        border-radius: 50%;
    }
    

    Then relaunch MailMate to make sure it doesn't make a difference. The border-radius line is just to make sure that you can see that the stylesheet is loaded and applied (the image is cropped in a circular shape).

    Also, I looked in my defaults and I have the following value (which I cannot recall adding myself):

    MmMessagesWebViewWebKitShouldRespectImageOrientation = 0;
    

    This indicates that you should also try this:

    defaults write com.freron.MailMate MmMessagesWebViewWebKitShouldRespectImageOrientation -bool YES
    

    Then relaunch and see if it makes a difference.

  • David Shepherdson

    David Shepherdson August 21st, 2016 @ 11:27 AM

    Thanks for the suggestions -- I've just tried both of those (independently and together), and (as expected?) neither made a difference (though the border-radius was definitely being applied).

    Some comments I've seen elsewhere (Chromium bug 25508 and W3C discussion of the spec) imply that it might work with the current WebKit implementation if the image is in an iframe rather than img tag; I've just tried this in my test page in Safari, and the image is indeed displayed with the correct orientation.

    But that wouldn't really be a practical solution for MailMate, especially with HTML messages that already contain img tags in the first place!

    So back to waiting for it to be implemented/fixed in WebKit, I'd say. At least it's not a big deal, given QuickLook uses the correct orientation anyway.

  • benny

    benny August 21st, 2016 @ 11:29 AM

    • State changed from “cantreproduce” to “closed”

    Ok, thanks for trying it out. I'll leave the image-orientation in the default HTML stylesheet in case support is added in the future.

  • David Shepherdson

    David Shepherdson August 21st, 2016 @ 11:31 AM

    Sounds great; thanks Benny!

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Mac OS X email client.

Shared Ticket Bins

People watching this ticket

Pages