@samatawy/diagrams
    Preparing search index...

    Class CanvasImageSerializer

    Serializes browser canvas content to raster image blobs. Supports PNG/JPEG/WebP/AVIF and falls back to PNG if the requested format is unsupported.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Serializes the given canvas or canvas wrapper to a Blob.

      Parameters

      • source: HTMLCanvasElement | { canvas: HTMLCanvasElement }

        The source canvas or an object containing a canvas.

      • options: ImageWriteOptions = {}

        Optional image write options, including MIME type and quality.

      Returns Promise<Blob>

      A promise that resolves to a Blob representing the serialized image.