This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2021.
* Some parts of this feature may have varying levels of support.
Note: This feature is only available in Web Workers.
The createImageBitmap() method of the WorkerGlobalScope interface creates a bitmap from a given source, optionally cropped to contain only a portion of that source. It accepts a variety of different image sources, and returns a Promise which resolves to an ImageBitmap.
createImageBitmap(image) createImageBitmap(image, options) createImageBitmap(image, sx, sy, sw, sh) createImageBitmap(image, sx, sy, sw, sh, options)
imageAn image source, which can be any one of the following:
sxThe x coordinate of the reference point of the rectangle from which the ImageBitmap will be extracted.
syThe y coordinate of the reference point of the rectangle from which the ImageBitmap will be extracted.
swThe width of the rectangle from which the ImageBitmap will be extracted. This value can be negative.
shThe height of the rectangle from which the ImageBitmap will be extracted. This value can be negative.
options OptionalAn object that sets options for the image's extraction. The available options are:
imageOrientationSpecifies how the bitmap image should be oriented.
from-imageImage oriented according to EXIF orientation metadata, if present (default).
flipYImage oriented according to EXIF orientation metadata, if present, and then flipped vertically.
noneImage oriented according to image encoding, ignoring any metadata about the orientation (such as EXIF metadata, that might be added to an image to indicate that the camera was turned sideways to capture the image in portrait mode).
premultiplyAlphaSpecifies whether the bitmap's color channels should be premultiplied by the alpha channel. One of none, premultiply, or default (default).
colorSpaceConversionSpecifies whether the image should be decoded using color space conversion. Either none or default (default). The value default indicates that implementation-specific behavior is used.
resizeWidthA long integer that indicates the output width.
resizeHeightA long integer that indicates the output height.
resizeQualitySpecifies the algorithm to be used for resizing the input to match the output dimensions. One of pixelated, low (default), medium, or high.
A Promise which resolves to an ImageBitmap object containing bitmap data from the given rectangle.
See Window.createImageBitmap() for examples.
| Specification |
|---|
| HTML> # dom-createimagebitmap-dev> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
createImageBitmap |
50 | 79 | 42 | 37 | 15 | 50 | 42 | 37 | 15 | 5.0 | 50 | 15 |
options_colorSpaceConversion_parameter |
58 | 79 | 98 | 45 | 15 | 58 | 98 | 43 | 15 | 7.0 | 58 | 15 |
options_imageOrientation_parameter |
52 | 79 | 93 | 39 | 15 | 52 | 93 | 41 | 15 | 6.0 | 52 | 15 |
options_premultiplyAlpha_parameter |
52 | 79 | 93 | 39 | 1715–17If the source image is anImageData object, then the premultiplyAlpha option does nothing. See bug 237082. |
52 | 93 | 41 | 1715–17If the source image is anImageData object, then the premultiplyAlpha option does nothing. See bug 237082. |
6.0 | 52 | 1715–17If the source image is anImageData object, then the premultiplyAlpha option does nothing. See bug 237082. |
options_resizeHeight_parameter |
54 | 79 | 98 | 41 | 15 | 54 | 98 | 41 | 15 | 6.0 | 54 | 15 |
options_resizeQuality_parameter |
54 | 79 | No | 41 | 15 | 54 | No | 41 | 15 | 6.0 | 54 | 15 |
options_resizeWidth_parameter |
54 | 79 | 98 | 41 | 15 | 54 | 98 | 41 | 15 | 6.0 | 54 | 15 |
svgimageelement_as_source_image |
59 | 79 | 65 | 46 | 17.2 | 59 | 65 | 43 | 17.2 | 7.0 | 59 | 17.2 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap