w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.52k stars 673 forks source link

[css-images] Should EXIF image orientation data be ignored if it comes after the image data in the encoded image? #11114

Open smfr opened 4 weeks ago

smfr commented 4 weeks ago

There was some discussion in https://github.com/w3c/csswg-drafts/issues/4165 about whether, in CSS images, EXIF image orientation should be ignored based on where it occurs in the encoded image file. Browsers seem, to some extent, to only respect EXIF if it occurs before the image data. If it comes at the end of the file, respecting it there might result in layout shifts as progressively loaded images rotate after loading.

Spec text is here.

smfr commented 4 weeks ago

Some complications:

smfr commented 4 weeks ago

@svgeesus

svgeesus commented 4 weeks ago

Related:

smfr commented 4 weeks ago

I confirmed that Core Graphics/ImageIO APIs on macOS/iOS don't tell us the ordering of the EXIF metadata in the file. Behavior differences here may be happenstance based on when we try to access the data.

jfkthame commented 4 weeks ago

FWIW, it seems fundamentally wrong to me that we should get a different result depending where in an image file the EXIF metadata occurs (unless, of course, the image file format specifies that it's only valid in a certain place).

I understand there's a concern that

If it comes at the end of the file, respecting it there might result in layout shifts as progressively loaded images rotate after loading

but to address that, authors should be advised to web-optimize their images by ensuring the EXIF metadata is at the beginning. (Surely there must be tools available that can do this?)