Skip to main content
Glama

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
NameRequiredDescriptionDefault
projectIdYesProject identifier
frameIndexNoFrame index (default: 0)
outputPathYesOutput file path

Implementation Reference

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

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