Skip to content

exportPng

function exportPng(params): Promise<PngOutput>;

Defined in: src/png.ts:46

Render an ASL definition directly to a PNG image.

Generates an SVG from the definition, then rasterizes it to PNG using the native resvg engine. Runs on Node only.

theme: 'auto' renders as 'light': a raster has no colour scheme to follow.

ExportPngParams

ASL definition plus diagram, background, PNG engine, and font options.

Promise<PngOutput>

The PNG buffer along with its dimensions and format metadata.

const { buffer, width, height } = await exportPng({
aslDefinition: asl,
backgroundColor: '#ffffff',
scale: 2,
});