convertToBlob method

JSPromise<Blob> convertToBlob([
  1. ImageEncodeOptions options
])

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

The desired file format and image quality may be specified. If the file format is not specified, or if the given format is not supported, then the data will be exported as image/png. Browsers are required to support image/png; many will support additional formats including image/jpeg and image/webp.

The created image will have a resolution of 96dpi for file formats that support encoding resolution metadata.

Implementation

external JSPromise<Blob> convertToBlob([ImageEncodeOptions options]);