Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-images-3] clarification on metadata position in specific file formats #8543

Closed
Sxderp opened this issue Mar 8, 2023 · 6 comments
Closed

Comments

@Sxderp
Copy link

Sxderp commented Mar 8, 2023

https://drafts.csswg.org/css-images-3/#url-metadata

Some file formats require the metadata to be at the end (.webp). I feel it's hostile to ignore the metadata in these files since you cannot change the location, it's part of the image spec. Can we get clarification on whether it should be ignore or not?

@svgeesus
Copy link
Contributor

On a related note, PNG originally allowed EXIF to be either before or after the image data. Web browsers ignore EXIF for things like rotation, if it is after the image data. And now that the PNG spec is being maintained again, we made it that EXIF has to be before the image data.

https://w3c.github.io/PNG-spec/#eXIf
https://w3c.github.io/PNG-spec/#5ChunkOrdering

@svgeesus
Copy link
Contributor

I agree that "Authors must produce their image files so that such metadata occurs before the image data in the image file." is harsh if the image format only allows it afterwards. Presumably CSS is not requiring the creation of invalid images.

Perhaps

If the choice exists for a given image format, authors must produce their image files so that such metadata occurs before the image data in the image file.

@Sxderp
Copy link
Author

Sxderp commented Jul 11, 2023

Just for some background this issue was spawned from an issue on the Firefox tracker. I argue the spec does not prohibit Firefox from implementing orientation for .webp files. The maintainers seem to think otherwise.

https://bugzilla.mozilla.org/show_bug.cgi?id=1761174#c4

@tnikkel
Copy link

tnikkel commented Jul 12, 2023

Just for some background this issue was spawned from an issue on the Firefox tracker. I argue the spec does not prohibit Firefox from implementing orientation for .webp files. The maintainers seem to think otherwise.

https://bugzilla.mozilla.org/show_bug.cgi?id=1761174#c4

In case it's relevant, I don't feel that this comment accurately summarizes the discussion in that bug.

@astearns astearns added this to Unslotted in TPAC 2023 agenda Sep 7, 2023
@astearns astearns moved this from Unslotted to Thursday Morning in TPAC 2023 agenda Sep 7, 2023
@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-images-3] clarification on metadata position in specific file formats, and agreed to the following:

  • RESOLVED: Don't require metadata at the start if the format doesn't allow it
The full IRC log of that discussion <emilio> chris: we have a requirement for metadata to be placed before some image formats
<fantasai> s/pass CR criteria/pass CR criteria and apply to HTML elements specifically,/
<emilio> ... except in some formats that's invalid
<miriam> q?
<emilio> ... I propose the spec that says that if there is a choice in the image format then put that before
<TabAtkins> +1
<florian> q+
<emilio> Proposed: Only ask for metadata before if that's acceptable
<miriam> ack florian
<emilio> florian: what we proposed is clear for what authors are supposed to do
<emilio> ... the other one is a requirement for UAs to ignore metadata-after-data
<emilio> ... so what's the proposal for that?
<emilio> chris: that is a different issue, we have different behavior
<emilio> ... e.g., webp metadata is ignored in some implementation
<emilio> ... if you have a giant webp that rotates the image at the end it seems bad
<emilio> florian: spec currently says SHOULD, should it be MUST?
<emilio> chris: yes
<emilio> Proposed: Only ask for metadata before the data if that's acceptable for a file format
<emilio> Proposed: Don't require metadata at the start if the format doesn't allow it
<dbaron> WebP also apparently doesn't offer progressive decoding
<emilio> RESOLVED: Don't require metadata at the start if the format doesn't allow it
<emilio> Proposed: UAs must not honor metadata at the end of the file
<florian> proposed: ignore layout affecting metadata when it is after the data, even in file formats where there is no choice
<emilio> myles: not sure if that's implementable
<emilio> q+
<emilio> emilio: dbaron pointed out that webp doesn't support incremental decoding
<emilio> myles: right, if no incremental decoding is fine to have metadata at the end
<florian> q+
<emilio> ... seems more of a quality of implementation issue
<astearns> proposed: if you have started progressive rendering, you SHOULD ignore subsequent layout affecting metadata
<emilio> ... I don't think ignoring the metadata should be a requirement
<emilio> ack emilio
<emilio> myles: I think I'm proposing no resolution at all
<emilio> ... then we can outreach PhotoShop or something to prefer metadata at the front or what not
<miriam> ack florian
<emilio> florian: I don't have that strong opinion on whether ignoring metadata
<emilio> ... but having a should and browsers doing different things is bad
<emilio> myles: I think we should remove that should from the spec
<miriam> ack dbaron
<emilio> dbaron: it's probably worth having something like what astearns proposed
<emilio> ... even if it's a may
<emilio> myles: that's worse right? You end up with the wrong orientation in one browser but not the other
<emilio> ... we probably want the same images to look the same once everything is loaded
<emilio> astearns: Not certain it's a terrible thing to have different behavior here
<emilio> ... you still get the image data and is flipping
<emilio> dbaron: if we are going to switch the spec we should have the data on what different implementations do
<dbaron> s/spec/spec from must or should for one thing to its opposite/
<emilio> florian: what about text that say that if the UA can't ignore metadata it can't ignore it in some cases but not in other
<emilio> ... I think I agree with myles that once the image loads it all should be the same
<emilio> miriam: should we take this to the issue / or a different issue?
<emilio> myles: sure

@tnikkel
Copy link

tnikkel commented Sep 14, 2023

The irc log states that "webp doesn't support incremental decoding", which is false. Both firefox and chrome currently incrementally decode webp. This seemed to be a key part of the discussion, so perhaps it should be revisited?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
TPAC 2023 agenda
Thursday Morning
Development

No branches or pull requests

6 participants