views:

51

answers:

2

I am building a new icon set for a CKEditor skin. The skin requires the icons to be one huge PNG file, where they are stacked underneath each other. The buttons then use the PNG as background image and define different y offsets to get the right image.

I have many separate icons in PNG format that I need to glue together into one such PNG file. One could write a PHP script that does this, but maybe somebody knows a quicker way? The special requirement is that all the icons need to occupy 32x32 pixels in the end, but the input material is not always exactly of that size. Icons smaller than 32x32 would have to be centered into a 32x32 space.

I thought about ImageMagick but doubt that it can fulfill that last requirement. Or can it?

+3  A: 

Hi, you can use an online sprite generator like this one

jbochi
Thanks, this is great but unfortunately doesn't allow me to set the order of the images - which I need to do, as the positions are already pre-defined.
Pekka
Indeed it does not. Maybe it sorts the images according to their names, but I suppose this would not solve your problem too. Good luck!
jbochi
+3  A: 

ImageMagick can indeed do it. You might find this page of montage examples helpful.

You'll probably want something like:

montage file1.png file2.png file3.png ... -background white -geometry '1x1+0+0<' -tile 1x output.png

but play about with it until you get the effect you want.

Dave
Edited to include example montage command line (taken/modified from the end of the examples link.
Dave