interop icon indicating copy to clipboard operation
interop copied to clipboard

createImageBitmap

Open sandstrom opened this issue 1 year ago • 1 comments

Description

Iron out the problems surrounding createImageBitmap.

Background

createImageBitmap has been around for a while, but the implementations has several flaws. Problems with image quality, EXIF handling, handling of color spaces, etc. These issues makes the API difficult to use in practice.

A few examples of use-cases for createImageBitmap:

  • Take snapshots from a video feed
  • Crop images on-device
  • Resize images on-device before uploading to a server
    • For example from <input capture….
    • On-device image resize has long been problematic, with the main workaround being the Canvas element, but every implementation I've seen has been buggy or hard to use, for example due to iOS canvas memory limits.
  • Extract sprites from a sprite sheet
  • Take non-rotated image pixels with an associated EXIF tag and output rotated pixels (without any EXIF), or put differently strip EXIF and apply rotation to image data.
    • This is useful since many server-side systems prefer to handle all images without accompanying exif rotation data.

Problem

Copied below are a few examples of browser bugs. These are not the only issues, but should give a few examples.

I think if all the issues around this method could be ironed out, it would enable a lot of great utility! But right now, it isn't quite there.

Specification

https://html.spec.whatwg.org/dev/imagebitmap-and-animations.html

Additional Signals

Can I Use

https://caniuse.com/createimagebitmap

Browser bugs

A few examples from the three top browser engines:

Chromium
  • https://issues.chromium.org/issues/41409681
  • https://issues.chromium.org/issues/40773069
  • https://issues.chromium.org/issues/41468523
  • https://issues.chromium.org/issues/339759426
Firefox
  • https://bugzilla.mozilla.org/show_bug.cgi?id=1677739
  • https://bugzilla.mozilla.org/show_bug.cgi?id=1363861
  • https://bugzilla.mozilla.org/show_bug.cgi?id=1797567
  • https://bugzilla.mozilla.org/show_bug.cgi?id=1189634
  • https://bugzilla.mozilla.org/show_bug.cgi?id=1818824
Safari
  • https://bugs.webkit.org/show_bug.cgi?id=202458
  • https://bugs.webkit.org/show_bug.cgi?id=234920
  • https://bugs.webkit.org/show_bug.cgi?id=237895

sandstrom avatar Sep 19 '24 14:09 sandstrom

Feel free to add more use-cases below.

sandstrom avatar Sep 22 '24 11:09 sandstrom

It would be great if the resizeQuality "high" worked properly in Chrome - currently it cannot do high-quality downscaling. This appears to have first been reported in 2017 here which was then merged in to this issue. I'm not sure how other browsers handle this but I believe needing high-quality downscaling is a common use case.

AshleyScirra avatar Oct 09 '24 13:10 AshleyScirra

https://wpt.fyi/results/html/canvas/element/manual/imagebitmap?label=master&label=experimental&aligned&q=createimagebitmap shows a certain number of failures, but I don't know if they cover all the bugs linked above.

gsnedders avatar Oct 11 '24 22:10 gsnedders

Thank you for proposing createImageBitmap for inclusion in Interop 2025.

We wanted to let you know that this proposal was not selected to be part of Interop this year.

On behalf of the entire Interop team, thank you for submitting this proposal for consideration. We got many more proposals than we could include in this year's project, necessitating some difficult choices. Please note this should not be taken as a comment on the technology as a whole, or our willingness to consider it for Interop in the future. We appreciate the work you put into your proposal, and would welcome your participation in future rounds of Interop.

For an overview of our process, see proposal selection. Thank you again for contributing to Interop 2025.

Posted on behalf of the Interop team.

wpt-interop avatar Feb 13 '25 17:02 wpt-interop

@wpt-interop Thanks for the update!

Any feedback on whether this was partly considered, or things to clarify for a submission next year?

I'm not arguing against your choice, I know it's hard to prioritize.

But just trying to understand if it was a lack of interest, vendor veto, not considered in-scope for interop, or if the problem isn't described well enough?

sandstrom avatar Feb 14 '25 14:02 sandstrom

Hi @sandstrom! I have been going through comments on proposals after we launched last week, sorry it took a while to get to yours.

Details of the proposal selection process are confidential, but I can however give you my thoughts and feedback.

I don't believe there's any controversy about this area but more a question of priorities.

The proposal is well scoped and you've compiled a solid set of bugs and why they're important. Something that would make the proposal even stronger is an analysis of the existing tests, to confirm if they cover the bugs you're seeing or not. This isn't necessarily easy to do of course. If you'd like to propose this again in the future, you can just list what you know about the tests and also ask for help to figure out the details.

Additional evidence that a lot of developers are being impacted is also great, but similarly not easy to provide.

You can also push for these bugs outside of the Interop program, most bugs that are fixed aren't part of Interop after all. In the case of Chromium, using the +1 feature on the bug is a great way to signal that it matters, and you can see that the bug with the most +1's in your list is already fixed.

Hope that helps! I'll go ahead and close this issue now.

foolip avatar Feb 20 '25 12:02 foolip

Tack @foolip!

sandstrom avatar Feb 20 '25 16:02 sandstrom

This comment was automatically generated based on the information you provided. Please don't edit it.

No web features (from the web-features project) were found in your proposal. If your proposal doesn't correspond to a web feature, that is fine.
Otherwise, please update your initial comment to include web-features: <feature-id>. To find feature IDs, use the web-features explorer.

github-actions[bot] avatar Dec 02 '25 16:12 github-actions[bot]