LogoPixi’VN
pixi-jsInterfaces

Interface: ExtractDownloadOptions

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/extract/ExtractSystem.d.ts:285

Options for extracting and downloading content from a renderer. Combines base extraction options with download-specific settings.

Example

// Basic download with default filename
renderer.extract.download({
    target: sprite
});

// Download with custom filename and region
renderer.extract.download({
    target: container,
    filename: 'screenshot.png',
    frame: new Rectangle(0, 0, 100, 100)
});

// Download with high resolution and background
renderer.extract.download({
    target: stage,
    filename: 'hd-capture.png',
    resolution: 2,
    clearColor: '#ff0000'
});

// Download with anti-aliasing
renderer.extract.download({
    target: graphics,
    filename: 'smooth.png',
    antialias: true
});

Combines all options from:

Common use cases:

  • Saving game screenshots
  • Exporting rendered content
  • Creating downloadable assets
  • Saving canvas state

See

Advanced

Properties

antialias?

> optional antialias?: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/extract/ExtractSystem.d.ts:189

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

Default

false

Example

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

clearColor?

> optional clearColor?: ColorSource

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/extract/ExtractSystem.d.ts:175

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

Example

// 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]
});

filename

> filename: string

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/extract/ExtractSystem.d.ts:298

The filename to use when downloading the content. Should include the desired file extension (e.g., .png).

Default

'image.png'

Example

renderer.extract.download({
    target: sprite,
    filename: 'my-screenshot.png'
});

frame?

> optional frame?: Rectangle

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/extract/ExtractSystem.d.ts:143

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

Example

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

resolution?

> optional resolution?: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/extract/ExtractSystem.d.ts:156

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

Default

1

Example

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

target

> target: Texture<TextureSource<any>> | Container<ContainerChild>

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/extract/ExtractSystem.d.ts:131

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

Example

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

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