开发者

Gluing a number of PNGs together

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 n开发者_如何学编程eed 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?


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.


you can use an online sprite generator like this one

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜