Skip to main content
Glama

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
NameRequiredDescriptionDefault
projectIdYesProject identifier
outputPathYesOutput file path
columnsNoNumber of columns in the sprite sheet (optional)

Implementation Reference

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yafeiaa/piskel-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server