Skip to content

Clarify the createImageBitmap orientation metadata handling #11234

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Based on whatwg#8118 (comment), we apply a rotation to the image from the metadata like EXIF ​​contains orientation first.
Then we determine the image orientation according to the imageOrientation value.

fixes whatwg#7210
<li><p>If <var>image</var> is an <code>img</code> element or a <code>Blob</code> object that
contains orientation metadata of the source such as <ref>EXIF</ref> metadata,
apply the orientation.</p>
</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is applicable regardless of whether the imageOrientation member is given.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, I changed to reflect the orientation at first.

data-x="dom-ImageOrientation-flipY">flipY</code></dfn>", <var>output</var> must be flipped
vertically, disregarding any image orientation metadata of the source (such as EXIF metadata),
if any. <ref>EXIF</ref></p>
vertically.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want these to be separate steps.

I also worry a bit that this isn't the right place to do it, but perhaps that can later be more properly abstracted. As we should really decode images in a single place after they come from the network and there we should apply the orientation metadata.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also worry a bit that this isn't the right place to do it, but perhaps that can later be more properly abstracted. As we should really decode images in a single place after they come from the network and there we should apply the orientation metadata.

There has been no agreement and this is merely a suggestion and implementation-oriented, but there was a conversation about making createImageBitmap a no-op to make it more tolerant of performance and reference from external specifications such as WebGPU.
As a result, I think it is best to just write down how EXIF ​​is handled for now, so as not to restrict implementation-oriented behavior such as the timing of decoding or storing byte sequences including EXIF ​​as internal variables in the API implementation.

cc: @ccameron-chromium

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants