How to merge images in command line?

Michael picture Michael · Nov 19, 2013 · Viewed 73.5k times · Source

I would like to try the CSS Sprite technique to load a few thumbnails as a single image. So I need to "merge" a few thumbnails in a single file offline in the server.

Suppose I have 10 thumbnails of the same size. How would you suggest I "merge" them from Linux command line?

Answer

Petr Mensik picture Petr Mensik · Nov 19, 2013

You can also try ImageMagic which is great for creating CSS sprites. Some tutorial about it here.

Example (vertical sprite):

convert image1.png image2.png image3.png -append result/result-sprite.png

Example (horizontal sprite):

convert image1.png image2.png image3.png +append result/result-sprite.png