utdev
utdev

Reputation: 4102

Imagemagick stick images next to each other

How can I create an Image using Imagemagick in which I stick for example 6 images next to each other, thus the background shall be transparent(.png file).

It shall look something like this: ( The black rectangles shall represent images )

enter image description here

How do I achieve this ?

Edit (Update)

So far I have done this image:

enter image description here

using this command:

montage img1.jpg img2.jpg img3.jpg img4.jpg img5.jpg img6.jpg -geometry +10+10 -resize 720x480 output.jpg

but I am not sure how to proceed further.

Upvotes: 0

Views: 739

Answers (2)

rostok
rostok

Reputation: 2137

This is just another way of doing this. I think it may be a little simpler than Mark's solution. Note the parentheses that groups commands into single image ouput. Also remember that IM requires space before and after the openining brackets.

magick -gravity center -background none -bordercolor none ( f1.jpg -border 10 ) ( f2.jpg f3.jpg f4.jpg -border 10 +append ) ( f5.jpg f6.jpg f7.jpg -border 10 +append ) -append output.png

More on appending is here however in most cases I prefer montage command.

Upvotes: 0

Mark Setchell
Mark Setchell

Reputation: 207345

You are almost there! Take your montage command and output the resulting 3x2 montage to stdout as a PNG into a new convert which appends it below your top.jpg image:

montage im*jpg -geometry +10+10 png:- | convert -gravity north top.jpg png:- -append result.png

enter image description here

If you are on Windows, you probably need:

montage *.jpg ...

or you can type it out in full:

montage img1.jpg img2.jpg img3.jpg img4.jpg img5.jpg img6.jpg -geometry +10+10 png:- | convert -gravity north top.jpg png:- -append result.png

Upvotes: 2

Related Questions