Advanced
// Basic canvas extraction
const canvas = renderer.extract.canvas({
target: sprite
});
// Image extraction with format
const image = await renderer.extract.image({
target: sprite,
format: 'png',
quality: 1
});
// Download with filename
renderer.extract.download({
target: sprite,
filename: 'screenshot.png'
});
// Advanced extraction with multiple options
const image = await renderer.extract.image({
target: container,
frame: new Rectangle(0, 0, 100, 100),
resolution: 2,
clearColor: '#ff0000',
antialias: true,
format: 'webp',
quality: 0.8
});
Supports three types of options:
Common use cases:
Options for extracting content from a renderer. Represents a union of all possible extraction option types. Used by various extraction methods to support different output formats and configurations.