window.kaolin
    Preparing search index...

    Function blobFromCanvas

    • Encode the full RGBA contents of a canvas as a PNG or JPEG Blob.

      • 'png' (default): lossless; alpha is preserved.
      • 'jpeg': lossy, typically smaller. JPEG cannot carry alpha — transparent pixels are composited against a background before encoding. Use PNG if you need alpha.

      Parameters

      • canvasOrId: CanvasOrId

        Canvas element or its DOM id.

      • format: "png" | "jpeg" = 'png'

        'png' (default) or 'jpeg'.

      • jpegQuality: number = 0.9

        0..1 quality for JPEG encoding (default 0.9). Ignored for PNG.

      Returns Promise<Blob>

      The encoded Blob, or null if the canvas is not found or encoding fails.