Closed Bug 1340927 Opened 8 years ago Closed 5 years ago

Message reader rotates based on EXIF data while message compose window does not - add option to physically rotate the image in composition

Categories

(Thunderbird :: Message Compose Window, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 75.0

People

(Reporter: firstpeterfourten, Assigned: Paenglab, Mentored)

References

()

Details

Attachments

(4 files)

Attached image Distorted image.PNG
I just received an e-mail message with an inline image, with a common photo aspect ratio and the vertical orientation (taller than wide). When I clicked Reply (or Forward), the image is displayed in the compose window with the same height and width, but the image contents are rotated 90 degrees and distorted (due to the compression in one dimension and expansion in the other). When I send the message to myself on a different account, even though it looks distorted, and receive it with Thunderbird, the received message shows the image with the correct orientation and without distortion. Therefore, I believe this is an issue with the message compose window. Attempting to replicate, I obtained a 640x480 image in the "vertical" format per EXIF data. Dragging that into a message, it appeared in the "horizontal" format so you had to turn your head to understand the picture but was not distorted. On receiving it, the image appeared in the vertical format, not distorted; attempting to reply or forward showed the image rotated (back to "horizontal" format but not distorted). I then tried two additional tests (#2 and 3), in which the image dimensions were fixed via the Image Properties dialogue. In #2, the dimensions were 640px wide by 480px tall, and looked very distorted in the compose window, but looked fine on receipt in the Message Reader UI. In #3, it looked fine in the compose window but bad in the reader UI. It is very unintuitive for a message sender to have to make an image look terrible in order for it to be received OK and vice versa, especially when the person who's sending the message may not know that the image file contains EXIF rotation details. Screenshot attached.
Attached image Nondistorted image.PNG
Steps to reproduce: Open the attached .eml in TB and notice the picture looks fine, then click Reply or Forward to see it distorted.
(In reply to WBT from comment #2) > Steps to reproduce: Open the attached .eml in TB and notice the picture > looks fine, then click Reply or Forward to see it distorted. Confirmed in current trunk, TB 54. Magnus, care to take a look at this one?
Flags: needinfo?(mkmelin+mozilla)
Version: unspecified → 54 Branch
Fixing this bug as described is just adding img { image-orientation: from-image; } ... to messengercompose.css. But it would be foolish to do so and a disservice to our users. image-orientation is basically only supported by Firefox, and there too unless the style needs to be specified explicitly to take effect. What I think we should add, is a Rotate context menu item for the image, so we sent out something the right picture and do not make the user look bad. This could be a fairly fun, and not particularly elaborate student project. What you'd do is: * add the context menu to rotate 90 deg or to the image specified orientation - see https://dxr.mozilla.org/comm-central/rev/e5e1510b8d914bfa8439b21ba3f73e4f2e83e957/mail/components/compose/content/messengercompose.xul#616 * oncommand create a copy of the image and rotate that image using JavaScript, and once done, replace the original image. The code is pretty much listed (except for rotation) at https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL - but you can just set image-rotation css to make that part work I think. * for bonus points, detect inserted images that would need this treatment and (offer to?) do it automatically
Mentor: mkmelin+mozilla
Flags: needinfo?(mkmelin+mozilla)
Keywords: student-project
OS: Unspecified → All
Hardware: Unspecified → All
Summary: Message reader rotates based on EXIF data while message compose window does not → Message reader rotates based on EXIF data while message compose window does not - add option to physically rotate the image in composition
Version: 54 Branch → Trunk
Slightly related, bug 401991.
See Also: → 401991

Actually this is a serious sort of issue as cameras, including phones, embed the rotation information in the image. Most mail clients simply work with the rotational information from the file, we are the odd one out here. Bug 298619 set display images to use the exif property. we need to be consistent here I think.

I see Firefox just landed bug 1607667 - so going forwards using EXIF information is the default, which apparently all the other browsers just switched to as well.

I'm not sure what that make of this bug. Maybe we should still do comment 4.

(In reply to Magnus Melin [:mkmelin] from comment #7)

I'm not sure what that make of this bug. Maybe we should still do comment 4.

This should be now the default with bug 1607667. And we can probably remove https://searchfox.org/comm-central/search?q=image-orientation%3A+from-image%3B&case=false&regexp=false&path=mail.

Not tested as I'm not at home.

Tested with today Daily and the image from the test message of this bug is always shown correctly.

Assignee: nobody → richard.marti
Status: NEW → ASSIGNED
Attachment #9127137 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9127137 [details] [diff] [review] 1340927-remove-image-orientation.patch Review of attachment 9127137 [details] [diff] [review]: ----------------------------------------------------------------- LGTM, r=mkmelin
Attachment #9127137 - Flags: review?(mkmelin+mozilla) → review+

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/8464a4cae70e
Remove the no more needed image-orientation: from-image; after landing of bug 167667. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 75.0

(In reply to Pulsebot from comment #11)

after landing of bug 167667

after landing of bug 1607667

Please double-check commit messages when reviewing and before pushing.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: