pixi.js
    Preparing search index...

    Interface BaseExtractOptionsAdvanced

    Options for extracting content from a renderer. These options control how content is extracted and processed from the renderer.

    // Basic extraction
    const pixels = renderer.extract.pixels({
    target: sprite,
    });

    // Extract with custom region and resolution
    const canvas = renderer.extract.canvas({
    target: container,
    frame: new Rectangle(0, 0, 100, 100),
    resolution: 2,
    });

    // Extract with background color and anti-aliasing
    const image = await renderer.extract.image({
    target: graphics,
    clearColor: '#ff0000',
    antialias: true
    });
    interface BaseExtractOptions {
        antialias?: boolean;
        clearColor?: ColorSource;
        frame?: Rectangle;
        resolution?: number;
        target: Texture<TextureSource<any>> | Container<ContainerChild>;
    }
    Index

    Properties

    antialias?: boolean

    Whether to enable anti-aliasing during extraction. Improves quality but may affect performance.

    false
    
    // Enable anti-aliasing for smoother edges
    renderer.extract.image({
    target: graphics,
    antialias: true
    });
    clearColor?: ColorSource

    The color used to clear the extracted content before rendering. Can be a hex number, string, or array of numbers.

    // Clear with red background
    renderer.extract.canvas({
    target: sprite,
    clearColor: '#ff0000'
    });

    // Clear with semi-transparent black
    renderer.extract.canvas({
    target: sprite,
    clearColor: [0, 0, 0, 0.5]
    });
    frame?: Rectangle

    The region of the target to extract. If not specified, extracts the entire target.

    // Extract a specific region
    renderer.extract.canvas({
    target: sprite,
    frame: new Rectangle(10, 10, 100, 100)
    });
    resolution?: number

    The resolution of the extracted content. Higher values create sharper images.

    1
    
    // Extract at 2x resolution for retina displays
    renderer.extract.image({
    target: sprite,
    resolution: 2
    });

    The target to extract. Can be a Container or Texture.

    // Extract from a sprite
    const sprite = new Sprite(texture);
    renderer.extract.pixels({ target: sprite });

    // Extract from a texture directly
    renderer.extract.pixels({ target: texture });