Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is the best way to create a single PNG image that contains multiple PNGs of the same size, such as 32x32 and 64x64?

I have a lot of images that I need to include in a single image so I can load them all as just one image. I only have access to open source tools. I need a fast/efficient way to do this. Is such an image called a sprite or a tile?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

When used in reference to images used in websites, combining images like this is referred to as a CSS sprite.

You can use the Imagemagick (open source) montage tool to quickly combine your icons into a big file.

This would make a 5x5 tile single image of everything in the current folder:

montage -background transparent -tile 5x5 *.png sprite.png

If there are less than 25 images, then blank spaces will be used. The last file on the command line is the output file.

Imagemagick is a command line tool and so often the fastest and most efficient way to do what you want.

share|improve this answer
    
Yes, montage allows you to tile multiple image, with customized border, padding, number of rows/columns... –  jcisio Dec 12 '11 at 3:26
    
what could a montage command look like to combine icons into a single file? say all icons in a given directory? most likely I will want to place them one row by row or column by column. –  Androider Dec 12 '11 at 6:19
    
I added an example to the answer –  Paul Dec 12 '11 at 8:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.