export_sprite_sheet
Export pixel art animations as a sprite sheet PNG to organize multiple frames into a single image file for game development or animation workflows.
Instructions
Export all frames as a sprite sheet PNG
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project identifier | |
| outputPath | Yes | Output file path | |
| columns | No | Number of columns in the sprite sheet (optional) |
Implementation Reference
- src/server/PiskelServer.ts:1248-1265 (handler)The internal handler method that calls the export logic and writes the file.
private exportSpriteSheet( projectId: string, outputPath: string, columns?: number ): object { const piskel = this.getProject(projectId); const pngData = exportSpriteSheetAsPNG(piskel, columns); const dir = path.dirname(outputPath); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); } fs.writeFileSync(outputPath, pngData); return { success: true, outputPath, - src/export/png.ts:377-383 (handler)The core logic function that generates the PNG binary data for the sprite sheet.
export function exportSpriteSheetAsPNG( piskel: Piskel, columns?: number ): Uint8Array { const sheet = createSpriteSheet(piskel, columns); return encodePNG(sheet.width, sheet.height, sheet.data); } - src/server/PiskelServer.ts:603-624 (registration)The definition and registration of the 'export_sprite_sheet' tool in the PiskelServer.
{ name: 'export_sprite_sheet', description: 'Export all frames as a sprite sheet PNG', inputSchema: { type: 'object', properties: { projectId: { type: 'string', description: 'Project identifier', }, outputPath: { type: 'string', description: 'Output file path', }, columns: { type: 'number', description: 'Number of columns in the sprite sheet (optional)', }, }, required: ['projectId', 'outputPath'], }, },