ImageBitmapRenderingContext
ImageBitmapRenderingContext transfers ImageBitmap content into a canvas efficiently. It can reduce overhead in pipelines that already produce frames as ImageBitmap objects.
Overview
ImageBitmapRenderingContext transfers ImageBitmap content into a canvas efficiently. It can reduce overhead in pipelines that already produce frames as ImageBitmap objects.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 66 | 79 | 46 | 11.1 | 66 | 11.3 | |
getContext (bitmaprenderer context) `bitmaprenderer` context | 66 | 79 | 46 | 11.1 | 66 | 11.3 |
getContext (bitmaprenderer context options alpha parameter) `options.alpha` parameter | 66 | 79 | | 11.1 | 66 | 11.3 |
| The ImageBitmapRenderingContext.canvas property, part of the Canvas API, is a read-only reference to the HTMLCanvasElement or OffscreenCanvas object that is associated with the given context. | 66 | 79 | 97 | 11.1 | 66 | 11.3 |
| The ImageBitmapRenderingContext.transferFromImageBitmap() method displays the given ImageBitmap in the canvas associated with this rendering context. The ownership of the ImageBitmap is transferred to the canvas as well. | 66 | 79 | 50 | 11.1 | 66 | 11.3 |
- This feature was removed in a later browser version (52)
- Previously available under a different name: transferImageBitmap (46)
Syntax
const ctx = canvas.getContext('bitmaprenderer');
const response = await fetch('image.png');
const blob = await response.blob();
const bitmap = await createImageBitmap(blob);
ctx.transferFromImageBitmap(bitmap); Live demo
Bitmap renderer preview
Transfer an ImageBitmap into a canvas that uses the bitmaprenderer context.
Swap bitmaps
Create new bitmaps on demand and replace the currently displayed frame.
Use cases
Frame transfer pipelines
Move decoded or worker-produced bitmap frames into a visible canvas with minimal extra processing.
Rendering optimization
Use it when ImageBitmap is already part of the workflow and presentation speed matters.
Cautions
- This API is narrower than the 2D context, so adopt it only when the surrounding rendering pipeline actually benefits.
- Performance gains depend on where the bitmap comes from and how often frames update.
Accessibility
- As with any canvas-based output, provide text alternatives when the visual content conveys essential meaning.
- Do not hide critical status or instructions inside bitmap-only rendering.
Related links
Powered by web-features