Merges multiple .PNG files to aid in the creation of spritesheets.
This script was used heavily in the creation of the art assets for Search For The Red Herring, and I found it to be a huge timesaver. As such, I’ve cleaned it up a bit and released it under the GPL for everyone to use.

Description

The script will take in any number of .PNG files as commandline arguments and will then generate an out.png file, while retaining all alpha data!

New in version 0.3 is the ability to merge images vertically as well as horizontally. Simply pass in the --vert commandline parameter. Also, there is a full example batch file included that will show you some ways to use this script to save even more time.

An example of how it works

Suppose you have 3 individual frames, and you want to combine them into one spritesheet. Here are the frames:

one.png
Merge Example Part 1
two.png
Merge Example Part 2
three.png
Merge Example Part 3

Then by using merge.py in the following way, you’ll end up with this result:

merge.py one.png two.png three.png

out.png
 Merge Example Part 4 - Result!

Requirements

Download

Version 0.3 (Oct 22, 2008) – merge-v0.3.zip

  • Cleaned up code, fixed some bugs
  • Added vertical merge support

Version 0.2 (Oct 23, 2006) – merge-v0.2.zip

  • Doesn’t work, only here for historical purposes

3 Responses to “Sprite Merge (merge.py)”

  1. [...] Sprite Merge (merge.py) [...]

  2. brian says:

    dude…really need you help… i can not seem to get my head round this…got python loaded …think i got PIL loaded just having a bit of truble merge …. kinda short on instructions and im kinda rubbish with anything thats not gota gui … could really do with this as i have 300+ sprites to sort

    many thanks

    swamppibboy@yahoo.co.uk

  3. fydo says:

    Hi there brian,

    Thanks for the question. There is an included batch file which demos all of the Sprite Merge functionality. Basically just ensure that all your sprites are of the same vertical height, then pass them all in as command-line parameters. ie.
    “merge.py sprite1.png sprite2.png sprite3.png”

    Hope this helps!

Leave a Reply