Sprite sheet generator

Combine individual animation frames into one sprite sheet PNG, with control over columns, spacing and padding, plus frame data and ready-to-use Pygame loading code.

Updated

Add frames

Drop PNG, GIF, WebP or JPEG files here, or

Columns 0 means automatic (a near-square sheet). Frames are placed left to right, top to bottom.

    Animation preview

    Export

    Add two or more images to build a sheet. Nothing is uploaded.
    On this page

    How to use it#

    1. Click Choose images or drop files on the box. Files are sorted by name, so walk_1.png, walk_2.png… stay in order.
    2. Drag thumbnails to reorder frames; the × button removes one.
    3. Set Columns (0 picks a near-square layout automatically), Spacing between cells and Padding around the sheet.
    4. Cell size "Largest frame" fits every frame; "Custom" uses a fixed size and crops or centres frames.
    5. Check the animation preview, then download the PNG, the JSON frame data, or copy the Pygame loader.

    Images are processed in your browser and never uploaded.

    Loading the sheet in Pygame#

    The copied loader matches your exact layout. It looks like this for four 32 × 32 frames in one row:

    Python
    FRAME_W, FRAME_H = 32, 32
    COLUMNS, ROWS = 4, 1
    SPACING, PADDING = 0, 0
    FRAME_COUNT = 4
    
    def load_frames(path="spritesheet.png"):
        sheet = pygame.image.load(path).convert_alpha()
        frames = []
        for i in range(FRAME_COUNT):
            col, row = i % COLUMNS, i // COLUMNS
            x = PADDING + col * (FRAME_W + SPACING)
            y = PADDING + row * (FRAME_H + SPACING)
            frames.append(sheet.subsurface((x, y, FRAME_W, FRAME_H)).copy())
        return frames

    Then follow the sprite animation tutorial to play the frames at a steady speed.

    The JSON format#

    JSON
    {
      "image": "spritesheet.png", "width": 128, "height": 32,
      "cell": { "w": 32, "h": 32 }, "columns": 4, "rows": 1, "spacing": 0, "padding": 0,
      "frames": [ { "index": 0, "name": "walk_1.png", "x": 0, "y": 0, "w": 32, "h": 32 } ]
    }

    Read it with Python's json module when frame positions are irregular or you want frame names in your code.

    When to use spacing and padding#

    If you scale or rotate frames in Pygame with filtering (smoothscale, rotozoom), neighbouring frames can bleed into each other along the edges. One or two pixels of spacing prevents that. For plain blit and scale, zero spacing is fine.

    ↑ ↓ to moveEnter to openEsc to close