Page 1 of 1

Center Images next to each other

Posted: 2016-11-22T02:36:40-07:00
by utbl
I have following command:

convert -background none -bordercolor none -gravity west -fill white img1.png label:"1" -border 0x5 +swap -append label:"Kapitel 1" -border 0x5 -append -write miff:- +delete img2.png label:"2" -border 0x5 +swap -append label:"Kapitel 2" -border 0x5 -append -write miff:- +delete img3.png label:"3" -border 0x5 +swap -append label:"Kapitel 3" -border 0x5 -append -write miff:- +delete img4.png label:"4" -border 0x5 +swap -append label:"Kapitel 4" -border 0x5 -append -write miff:- +delete img5.png label:"5" -border 0x5 +swap -append label:"Kapitel 5" -border 0x5 -append miff:- | montage -set label "" miff:- -tile 3x2 -geometry +15-10 -background none result

which creates me an image with 5 image, each image has a text above and under.

The first 3 images above are "centered", but the last 2 images are not centered, how can I center so to say the last 2 image?

If I pick for instance 6 images everything looks fine, but I have to have an option for 1,2,3,4 and 5 images aswell and center them (horizontal and vertical)

How do I achieve this

Re: Center Images next to each other

Posted: 2016-11-22T10:46:38-07:00
by fmw42
Can you provide both your input and output images so we can see what is happening. Also please also provide your IM version and platform whenever you ask questions, since syntax may differ. You can upload to some place such as dropbox.com and put the URLs here.

Re: Center Images next to each other

Posted: 2016-11-22T16:14:51-07:00
by glennrp
The "montage" utility doesn't have the capability you want. You'll need to make two separate montages, one for each row, and extend any 1- or 2-image row to full width, then use "convert -append" or "magick -append" to put the rows together.

For greater control over the layout (but more work for you), you can use "magick" or "convert" with the "-mosaic" option or a series of "-draw image over ..." operations.