W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2015

Re: [whatwg] Effect of image-orientation on naturalWidth/Height

From: Seth Fowler <seth@mozilla.com>
Date: Thu, 12 Mar 2015 16:14:05 -0700
Message-Id: <C9C60546-A934-4AD5-B4DC-84FAD5130C67@mozilla.com>
To: "L. David Baron" <dbaron@dbaron.org>
Cc: WHATWG List <whatwg@whatwg.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
The more I think about this, the more I agree with David. It really does make more sense to act like the rotation is part of the image format, because after all it *is*, at least when from-image is used.

This approach also gives us a smoother path to eventually respecting EXIF orientation by default. If we did that, we’d want naturalWidth and naturalHeight to take EXIF orientation into account, so planning for that with the behavior of image-orientation makes sense.

And FWIW, Safari (which respects EXIF orientation in image documents and by default on mobile) does appear to take EXIF orientation into account for naturalWidth and naturalHeight, so this approach is web compatible.

Consider this a second vote for “naturalWidth and naturalHeight should respect image-orientation”.

- Seth

> On Mar 10, 2015, at 10:09 AM, L. David Baron <dbaron@dbaron.org> wrote:
> 
> On Monday 2015-03-09 16:52 -0700, Tab Atkins Jr. wrote:
>> That's a good question.  I suspect that .naturalWidth/Height should
>> return the image's dimensions before applying CSS rotations.  This is
>> likely to be surprising, but also probably the correct answer for
>> separation-of-concerns reasons.
>> 
>> I wonder whether I need to tweak Images, or Hixie needs tweak <img>. Hmm.
> 
> I really think that the mechanism for opting in to honoring EXIF
> should make the browser act as though the rotation were in the image
> format.
> 
> It's a compatibility hack (because implementations were initially
> shipping without EXIF support, and there may be a dependency on
> that), but once the developer has opted in, everything should really
> act like the rotation is part of the image format.
> 
> -David
> 
> -- 
> 𝄞   L. David Baron                         http://dbaron.org/   𝄂
> 𝄢   Mozilla                          https://www.mozilla.org/   𝄂
>             Before I built a wall I'd ask to know
>             What I was walling in or walling out,
>             And to whom I was like to give offense.
>               - Robert Frost, Mending Wall (1914)
Received on Thursday, 12 March 2015 23:14:35 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:29 UTC