Merge Images Side by Side(Horizontally)
ImageMagick ships with the montage
utility. Montage will append each image side-by-side allowing you to adjust spacing between each image (-geometry
), and the general layout (-tile
).
montage [0-4].png -tile 5x1 -geometry +0+0 out.png
Other examples can be found on Montage Usage page
ImageMagick has command line tool named 'convert' to merge images horizontally, or for other purpose. i have tried this command and working perfectly on your case:
To join images horizontally:convert +append *.png out.png
To stack images vertically:convert -append *.png out.png
Use -resize
if the images don't have the same width/height
You can fix the height for all of them with the -resize
option, e.g. to fix a 500 pixel height on two images joined horizontally:
convert +append image_1.png image_2.png -resize x500 new_image_conbined.png
Or for vertical joins, you would want to set a fixed width instead:
convert -append image_1.png image_2.png -resize 500x new_image_conbined.png
Example:
image_1.png 1067x600
image_2.png 1920x1080
new_image_conbined.png 889x500
Related:
- https://askubuntu.com/questions/226054/how-do-i-join-two-images-together
- https://superuser.com/questions/290656/combine-multiple-images-using-imagemagick
How to do it interactively with GIMP
If you need to crop/resize images interactively first, which is often the case, then GIMP is the perfect tool for it, here's a detailed step-by-step: https://graphicdesign.stackexchange.com/questions/83446/gimp-how-to-combine-two-images-side-by-side/145543#145543
SVGs
ImageMagick 6.9.11-60 doesn't handle them, so see:
- How to concatenate SVG files lengthwise from linux command line?
- https://graphicdesign.stackexchange.com/questions/137096/is-there-a-way-to-stack-two-svgs-on-top-of-each-other
- https://graphicdesign.stackexchange.com/questions/90844/joining-together-multiple-svg-images
Very simple with ImageMagick (brew install imagemagick
)
convert +append image_1.png image_2.png new_image_conbined.png