Skip to content

exportPng

function exportPng(params): Promise<PngOutput>;

Defined in: src/png.ts:47

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 by default. Runs on Node only.

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,
});