Field Notes
    Preparing search index...

    Interface ExportImageOptions

    Export options for embedding the exported elements as a loadable scene.

    interface ExportImageOptions {
        afterElements?: (
            ctx: CanvasRenderingContext2D,
            width: number,
            height: number,
        ) => void;
        background?: string;
        elementRegistry?: ElementRegistry;
        embedScene?: boolean;
        expectedCanvasTypes?: ReadonlySet<string>;
        filter?: (element: CanvasElement) => boolean;
        format?: "png" | "jpeg";
        frameId?: string;
        htmlPainters?: HtmlPainterRegistry;
        htmlTimeoutMs?: number;
        imageTimeoutMs?: number;
        maxDimension?: number;
        maxPixels?: number;
        onAssetError?: (error: ExportAssetError) => void;
        onHtmlError?: (error: HtmlExportError) => void;
        onSceneOmitted?: (info: { bytes: number; limit: number }) => void;
        padding?: number;
        quality?: number;
        region?: { h: number; w: number; x: number; y: number };
        renderHooks?: RenderHooks;
        renderHtml?: HtmlExportRenderer;
        requiredCapabilities?: readonly string[];
        scale?: number;
        scaleMode?: "fit" | "exact";
        strictMissingCanvasHtml?: boolean;
        theme?: FixedTheme;
    }

    Hierarchy (View Summary)

    Index
    afterElements?: (
        ctx: CanvasRenderingContext2D,
        width: number,
        height: number,
    ) => void
    background?: string
    elementRegistry?: ElementRegistry

    Element adapters used for extension bounds and rendering.

    embedScene?: boolean

    Embed the exported elements as a loadable scene. Default false. The scene holds every element inside the export bounds regardless of what paints over it (fog, hooks, full-canvas extensions): never embed in an export meant for viewers who must not see those elements.

    expectedCanvasTypes?: ReadonlySet<string>

    htmlTypes that must route to canvas even before a painter for them is registered — lets a host declare intent up front (mirrors HtmlPainterRegistry.expect).

    filter?: (element: CanvasElement) => boolean
    format?: "png" | "jpeg"

    Output encoding. Defaults to 'png'. JPEG output is opaque — a transparent background renders as black; keep an opaque background (the default follows the theme) for JPEG exports.

    frameId?: string
    htmlPainters?: HtmlPainterRegistry

    Registry of canvas-backed html painters, keyed by htmlType. When absent (or when an element's htmlType isn't claimed), html elements fall back to the legacy DOM-raster path (renderHtml).

    htmlTimeoutMs?: number

    Maximum wait for each HTML renderer. Defaults to 10 seconds.

    imageTimeoutMs?: number

    Maximum wait for each image asset and font file. Defaults to 10 seconds.

    maxDimension?: number

    Maximum width or height of any allocated export canvas. Defaults to 16,384.

    maxPixels?: number

    Maximum pixel count of any allocated export canvas. Defaults to 67,108,864.

    onAssetError?: (error: ExportAssetError) => void

    Called when an image cannot be loaded or embedded. The export continues.

    onHtmlError?: (error: HtmlExportError) => void

    Called when an HTML embed cannot be rendered or encoded. The export continues.

    onSceneOmitted?: (info: { bytes: number; limit: number }) => void

    Called when the scene exceeds 16 MiB and is left out; the export still succeeds.

    padding?: number
    quality?: number

    Encoder quality in (0, 1]. Only meaningful for 'jpeg'.

    region?: { h: number; w: number; x: number; y: number }

    Optional world-space crop. When set it replaces the computed content bounds; padding still applies around it. Elements outside the region clip naturally. A region export with no intersecting elements still produces a background-filled image.

    renderHooks?: RenderHooks

    Per-surface hooks installed by viewport plugins.

    renderHtml?: HtmlExportRenderer

    Converts an application-owned HTML embed into a ready canvas image source.

    requiredCapabilities?: readonly string[]

    Render capabilities the export must satisfy, added to the registry's stored requirement.

    scale?: number
    scaleMode?: "fit" | "exact"

    'exact' (default) throws when scale × bounds exceeds maxDimension/maxPixels. 'fit' reduces the effective scale to the largest value that satisfies both caps (never above the requested scale).

    strictMissingCanvasHtml?: boolean

    When true, a canvas-routed html element with no active painter throws HtmlPainterMissingError instead of reporting onHtmlError and continuing. DOM-routed html elements are never affected — a missing renderHtml stays a non-fatal 'unsupported' diagnostic regardless of this flag.

    theme?: FixedTheme

    Theme the export draws with. Direct exports default to light; viewport exports use its theme.