Provide style attribute to consider exif orientation when composing HTML messages with inline images

NEW
Unassigned

Status

MailNews Core
Composition
4 years ago
3 years ago

People

(Reporter: rsx11m, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
+++ This bug was initially created as a clone of Bug #877520 +++

(Quoting rsx11m from bug 877520 comment #17)
> (In reply to Richard Marti [:Paenglab] from bug 877520 comment #6)
> > In HTML it should be shown as the creator created the page/mail and the
> > orientation should be taken from page/mail's CSS to not break the layout.
> > Until now no HTML creator tool that I know supports the EXIF orientation.
> 
> So, when we compose a message in HTML, should the <IMG> tag be supplied with
> a style="image-orientation: from-image;" attribute, given that there usually
> are no CSS style sheets associated with messages? I'll be happy to open a
> new MailNews bug for that, but maybe it's not the right thing to do at that
> level, or the Editor code should provide that option. Opinions?

(Quoting Richard Marti [:Paenglab] from bug 877520 comment #18)
> I also don't know what's the right thing, but I think opening a MailNews bug
> looks okay.

(Quoting Joe Sabash from bug 877520 comment #19)
> I think you would still see a high level of resistance to having the Editor
> automatically applying an inline styles. The argument would be compatibility
> with other software, I think. But they are catching up with CSS support.
> Gmail for example handles inline styles, but not stylesheets AFAICT.
> 
> My particular use case is with images received from Iphones. And these are
> as attachments and not inline. I really don't think it's possible to insert
> an inline image with an Iphone. Tablets might be another story.
> 
> It would make a nice extension though, to be able to control image
> orientation while viewing.

Comment 1

4 years ago
Well, it would be perfectly possible to physically correct the rotation (from within the editor) so that sounds a lot more appealing and compatible with all software.
(Reporter)

Comment 2

4 years ago
I.e., would it be better to make this an RFE for the Editor component?

There are other overlays to the Image Properties dialog already, most notably the moz-do-not-send attribute, thus it should be feasible to add such an option just for MailNews composition. But, it certainly would be nicer to have full rotation control in the core feature, I'd agree.
Flags: needinfo?(ehsan)

Comment 3

4 years ago
(In reply to Magnus Melin from comment #1)
> Well, it would be perfectly possible to physically correct the rotation
> (from within the editor) so that sounds a lot more appealing and compatible
> with all software.

The UI is there of course to add inline styles but it's not very discoverable or usable for that matter.

Double click on an inline image offers: "advanced" (advanced always brings on a smile here)
Because I don't think anything has changed there for quite some time.

The problems are myriad:
 1 There is syntax checking for the property, but no feedback as to where you went wrong
 2 Auto-complete would do wonders to really make this usable
 3 Often, adding one style erases another (margins/borders-left/right for one)

I do think it's time to move to a more CSS based editor, and make common wants like observing exif more user friendly, if not automatic. After all if the composer of the mail put there, then that's how  he intended to display.

Comment 4

4 years ago
Can somebody please summarize what you're asking for this bug, hopefully without referencing the Thunderbird use case?  I have no idea how the Image Properties dialog in Thunderbird is implemented, so it's hard for me to understand what this bug is about.
Flags: needinfo?(ehsan)
(Reporter)

Comment 5

4 years ago
Sure. The basic idea is to add a style attribute to enable interpretation of the EXIF image orientation information optionally provided by JPEG images. Thus, if an "image/jpeg" or "image/jpg" <IMG> node is inserted (and ideally only if it actually contains EXIF information), a value of "image-orientation: from-image;" should be added to the "style" attribute.

A use case from Joe's comment #3 is an attachment arriving from an iPhone (which may be rotated or upside-down, depending on how the phone was held when the photo was taken), which is now shown correctly after bug 877520 (TB) and bug 915909 (SM). When you take that photo and put it into the body of a new HTML message you compose, it will be rotated or upside-down as encoded. Considering the orientation information provided in the image when composing the message would resolve the issue, but still rely on the recipient's mail program to understand the image-orientation CSS definition.

The related question is if that option should be exposed in the Image Properties UI (which actually lives in editor/ui/dialogs and is as such part of comm-central, thus may not be of relevance for the editor core code). Some checkbox like "[x] Use orientation information from the image" could be added to the Dimensions or Appearance tabs of that dialog. It would be checked by default for JPEG images with EXIF orientation definition and unchecked/disabled in all other cases.

Later stages could introduce 0/90/180/270-degrees and flip options, but that's getting closer to the general CSS support envisioned. Physically altering the image to have the desired orientation without style information necessary would imply recoding of the image and thus may not be desired (specifically for JPEG as it involves loss of quality in the process).

Comment 6

4 years ago
(In reply to rsx11m from comment #5)
> Physically
> altering the image to have the desired orientation without style information
> necessary would imply recoding of the image and thus may not be desired
> (specifically for JPEG as it involves loss of quality in the process).

FWIW, lossless rotation of JPEGs *is* possible provided your image dimensions are multiples of the Minimum Coded Unit (MCU) block size, typically 8x8, 8x16, 16x8 or 16x16 pixels. Specifically, uncropped images from phones and cameras *are* generally multiples of the block size, so unless the image has been cropped to a non-standard size before sending it is perfectly possible to rotate it. (See e.g. http://www.betterjpeg.com/lossless-rotation.htm for a fuller explanation). 

I'll leave the question of whether such an algorithm should be included in the editor, and if so whether there are already suitably licensed implementations, to others more qualified to comment!

Comment 7

4 years ago
I see.  I think the proper place to discuss this is on the www-style mailing list to see if there is interest from other browser vendors to support something like this.

Comment 8

3 years ago
This bug has lingered for several years,  while Microsoft have apparently added Exif to their image manipulator in Office and just about every smartphone manufacturer in existence is using Exif to set orientation.

Can we move forward with an image rotated tag? Or is inserting the image and it appearing upside down the way to go.  Currently it appears correctly oriented until the message is saved to drafts or sent per https://support.mozilla.org/en-US/questions/1037570
You need to log in before you can comment on or make changes to this bug.