Re: [whatwg] Effect of image-orientation on naturalWidth/Height
> On Mar 9, 2015, at 5:06 PM, Garrett Smith wrote: > > On 3/9/15, Tab Atkins Jr. wrote: >> That's a good question. I suspect that .naturalWidth/Height should >> return the image's dimensions before applying CSS rotations. > > I think that that is not what Seth was asking about. IIUC, he asked > about EXIF rotation info. When you take a pic in your iPhone, if there > is rotation data on it, and if that data is not removed, the image > will look rotated in browsers that recognize this header, like Safari. No, Tab is right. The question is about the CSS image-orientation property, which allows (among other things) an image to be rotated according to the orientation specified in its EXIF info. - Seth
Re: [whatwg] Effect of image-orientation on naturalWidth/Height
On 3/9/15, Tab Atkins Jr. wrote: > On Mon, Mar 9, 2015 at 4:01 PM, Seth Fowler wrote: On 3/9/15, Seth Fowler wrote: > Hi all! > > I wanted to get the opinion of this list on how image-orientation and the > element's naturalWidth and naturalHeight properties should interact. > The css-images level 3 spec says: > So there is now a property called naturalWidth and that is the intrinsic width. And you want to know about the rotation and how that affects it. Great question. ... but I have a different question:- Why not call it what it is? More names for the same thing adds more confusion. There is already enough complexity with intrinsic width, the width property, computedStyle's width, and clientWidth. Calling intrinsic width, a term that has existed for years, naturalWidth - adds complexity. APIs that use ubiquitous language are generally less confusing than those that do otherwise. Or maybe I've misunderstood Evans' DDD. > That's a good question. I suspect that .naturalWidth/Height should > return the image's dimensions before applying CSS rotations. I think that that is not what Seth was asking about. IIUC, he asked about EXIF rotation info. When you take a pic in your iPhone, if there is rotation data on it, and if that data is not removed, the image will look rotated in browsers that recognize this header, like Safari. -- Garrett @xkit ChordCycles.com garretts.github.io personx.tumblr.com
Re: [whatwg] Effect of image-orientation on naturalWidth/Height
On Mon, Mar 9, 2015 at 4:01 PM, Seth Fowler wrote: > Hi all! > > I wanted to get the opinion of this list on how image-orientation and the > element’s naturalWidth and naturalHeight properties should interact. > The css-images level 3 spec says: > > "The intrinsic height and width are derived from the rotated rather than the > original image dimensions.” > > The HTML spec says: > > "The IDL attributes naturalWidth and naturalHeight must return the intrinsic > width and height of the image, in CSS pixels, if the image is available, or > else 0.” > > On the surface, it seems clear that image-orientation must affect > naturalWidth/Height. However, I’m not sure whether this was intended, and I > don’t have a strong intuition for whether this is more or less surprising to > content authors than having these two features be totally independent. > > There is certainly a potential performance cost if the two features do > interact, since that means that naturalWidth/Height will depend on style > information. On the other hand, naturalWidth and naturalHeight would > definitely take EXIF orientation into account if we respected it by default, > so perhaps they also should when content authors opt in to EXIF orientation > support using image-orientation. > > Let me know what you think. 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 . Hmm. ~TJ
[whatwg] Effect of image-orientation on naturalWidth/Height
Hi all! I wanted to get the opinion of this list on how image-orientation and the element’s naturalWidth and naturalHeight properties should interact. The css-images level 3 spec says: "The intrinsic height and width are derived from the rotated rather than the original image dimensions.” The HTML spec says: "The IDL attributes naturalWidth and naturalHeight must return the intrinsic width and height of the image, in CSS pixels, if the image is available, or else 0.” On the surface, it seems clear that image-orientation must affect naturalWidth/Height. However, I’m not sure whether this was intended, and I don’t have a strong intuition for whether this is more or less surprising to content authors than having these two features be totally independent. There is certainly a potential performance cost if the two features do interact, since that means that naturalWidth/Height will depend on style information. On the other hand, naturalWidth and naturalHeight would definitely take EXIF orientation into account if we respected it by default, so perhaps they also should when content authors opt in to EXIF orientation support using image-orientation. Let me know what you think. Thanks, - Seth