export_png
Export a pixel art animation frame as a PNG file from the Piskel MCP Server. Specify project ID, frame index, and output path to save the image.
Instructions
Export a frame as PNG
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project identifier | |
| frameIndex | No | Frame index (default: 0) | |
| outputPath | Yes | Output file path |
Implementation Reference
- src/server/PiskelServer.ts:1226-1245 (handler)The handler method in the server that handles the export_png tool request, which orchestrates the call to exportMergedFrameAsPNG and writes the file.
private exportPNG( projectId: string, frameIndex: number, outputPath: string ): object { const piskel = this.getProject(projectId); const pngData = exportMergedFrameAsPNG(piskel, frameIndex); const dir = path.dirname(outputPath); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); } fs.writeFileSync(outputPath, pngData); return { success: true, outputPath, size: pngData.length, }; - src/export/png.ts:388-394 (helper)The core utility function that merges layers and performs the PNG export logic.
export function exportMergedFrameAsPNG( piskel: Piskel, frameIndex: number ): Uint8Array { const merged = mergeLayersAtFrame(piskel, frameIndex); return exportFrameAsPNG(merged); }