-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Hajime-san
wants to merge
4
commits into
whatwg:main
Choose a base branch
from
Hajime-san:update-createimagebitmap-flip
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
Separate the steps
- Loading branch information
commit 81d43bf81f5440f6d43b03acf4c0f709d0c9b264
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119255,16 +119255,22 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> { | |
choice of scaling algorithm.</p></li> | ||
|
||
<li> | ||
<p>Apply the orientation to <var>output</var>, 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 at first, and if the value of the <dfn dict-member | ||
for="ImageBitmapOptions"><code data-x="dom-ImageBitmapOptions-imageOrientation">imageOrientation | ||
</code></dfn> member of <var>options</var> is "<dfn enum-value for="ImageOrientation"><code | ||
data-x="dom-ImageOrientation-flipY">flipY</code></dfn>", <var>output</var> must be flipped | ||
vertically.</p> | ||
|
||
<p class="note">If the value is "<dfn enum-value for="ImageOrientation"><code | ||
data-x="dom-ImageOrientation-from-image">from-image</code></dfn>", no extra step is needed.</p> | ||
<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 to <var>output</var>.</p> | ||
<p>Let <var>val</var> be the value of <dfn dict-member for="ImageBitmapOptions"><code | ||
data-x="dom-ImageBitmapOptions-imageOrientation">imageOrientation</code></dfn> member of | ||
<var>options</var>, and then run these substeps:</p> | ||
|
||
<ol> | ||
<li><p>If <var>val</var> is "<dfn enum-value for="ImageOrientation"><code | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is applicable regardless of whether the imageOrientation member is given. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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-from-image">from-image</code></dfn>", no extra step is needed.</p> | ||
</li> | ||
<li><p>If <var>val</var> is "<dfn enum-value for="ImageOrientation"><code | ||
data-x="dom-ImageOrientation-flipY">flipY</code></dfn>", the <var>output</var> must be | ||
flipped vertically.</p> | ||
</li> | ||
</ol> | ||
|
||
<p class="note">There used to be a "<dfn><code | ||
data-x="dom-ImageBitmapOptions-imageOrientation-none">none</code></dfn>" enum value. It was | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
createImageBitmap
does not immediately convert color space, premultiply alpha, etc. #11029cc: @ccameron-chromium