This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The OffscreenCanvas.convertToBlob() method creates a Blob object representing the image contained in the canvas.


Promise<Blob> OffscreenCanvas.convertToBlob(options);


options Optional

You can specify several options when converting your OffscreenCanvas object into a Blob object, for example:

const blob = offscreenCanvas.convertToBlob({
  type: "image/jpeg",
  quality: 0.95


  • type: A DOMString indicating the image format. The default type is image/png.
  • quality: A Number between 0 and 1 indicating image quality if the type option is image/jpeg or image/webp. If this argument is anything else, the default value for image quality is used. Other arguments are ignored.

Return value

A Promise returning a Blob object representing the image contained in the canvas.


var offscreen = new OffscreenCanvas(256, 256);
var gl = offscreen.getContext("webgl");

// ... some drawing using the gl context ...

offscreen.convertToBlob().then(function(blob) {

// Blob { size: 334, type: "image/png" }


Currently drafted as a proposal: OffscreenCanvas.

Browser compatibility

No compatibility data found. Please contribute data for "api.OffscreenCanvas.convertToBlob" (depth: 1) to the MDN compatibility data repository.


See also

Document Tags and Contributors

Contributors to this page: mdnwebdocs-bot, kebo, some-body, fscholz
Last updated by: mdnwebdocs-bot,