const offscreen = new OffscreenCanvas(256, 256);
const gl = offscreen.getContext("webgl");
// Perform some drawing using the gl context
offscreen.convertToBlob().then((blob) => console.log(blob));
// Blob { size: 334, type: "image/png" }OffscreenCanvas: convertToBlob() method / notebook
OffscreenCanvas: convertToBlob() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.