Skip to content

window.createImageBitmap #731

@sandstrom

Description

@sandstrom

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 a photo from <input type="file" capture="environment">.
    • 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
Firefox
Safari

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions