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.


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:

Merge Example Part 1
Merge Example Part 2
Merge Example Part 3

Then by using in the following way, you’ll end up with this result: one.png two.png three.png

 Merge Example Part 4 - Result!



Version 0.3 (Oct 22, 2008) –

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

Version 0.2 (Oct 23, 2006) –

  • Doesn’t work, only here for historical purposes

6 responses to “Sprite Merge (”

  1. […] Sprite Merge ( […]

  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

    [email protected]

  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.
    “ sprite1.png sprite2.png sprite3.png”

    Hope this helps!

  4. […] A friend of mine has a simple script tool for joining images up into sprite sheets. It is nice, but I didn’t want to deal with a command line thing every time and I wanted the process to be more accessible to users, so I created a GUI spritesheet tool in wxPython. […]

  5. Ram K. says:

    the following is what I did to get this working on python 3.2:
    2. install it…
    3. replace “print “Processing: ” + arg” with print (“Processing: “, arg) in
    4. go through the rest of the print statements and add parentheses so “print ‘Unknown option.'” becomes print (‘Unknown option.’) and so on…

    profit 🙂

  6. WH says:

    Thanks for posting this. Unfortunately, the script does not work with Python 3 and cannot merge large numbers of images. I needed to do exactly that for a project, so I wrote my own image merging script.

    You can download the script here:

    You will need a version of PIL compatible with Python 3. I recommend Pillow (, which you can install from PyPI.

    I know this post is super old… but hopefully the script will be useful to someone who happens to Google into this like I did.

Leave a Reply

Your email address will not be published. Required fields are marked *