How to make a photomontage?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Fafou

How to make a photomontage?

Post by Fafou »

Hello,

I make a lot of photo for my job and I have to do photomontages.
Each montage is composed of 30 photos, 1 column, 30 lines.
Every photo is in the portrait format and is named IMG_xxxx (number increasing)
Finally I have to resize the montage in 645*29040.

I would like to do the maximum of tasks automatically.
- Open the 30 photos.
- Put one and one under the others.
- Resize the montage.

May someone make a script which can do it please, or explain me how to do? Thank you for your help.

P.S: Excuse me for the mistakes, I don't speak English very well.
Fab
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: How to make a photomontage?

Post by Bonzo »

Try:

Code: Select all

convert ( IMG_0001.jpg -append IMG_0002.jpg -append IMG_0003.jpg -append ) -resize 645x29040 append.png
OR

Code: Select all

montage IMG_0001.jpg IMG_0002.jpg IMG_0003.jpg -tile x3 | convert -resize 645x29040 - tile.png
Fafou

Re: How to make a photomontage?

Post by Fafou »

I tried with 3 photos in a directory:

Result for the first command:

Code: Select all

convert ( IMG_9346.JPG -append IMG_9347.JPG -append IMG_9348.JPG -append ) -resize 645x2904 append.png
bash: Erreur de syntaxe près du symbole inattendu « IMG_9346.JPG »
( = Error of syntax "next to" the unexpected symbol "IMG_9346.JPG")

I tried with double quotes, same result, and I check the image's names; it's correct.

And for the second command:

Code: Select all

montage IMG_9346.JPG IMG_9347.JPG IMG_9348.JPG -tile x3 | convert -resize 645x2904 - tile.png
montage: missing an image filename `x3'.
convert: missing an image filename `tile.png'.
Thank for your help.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to make a photomontage?

Post by fmw42 »

what is your IM version and are you on Unix or Windows? Are all the images the same size?
Last edited by fmw42 on 2009-04-02T11:12:53-07:00, edited 1 time in total.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: How to make a photomontage?

Post by Bonzo »

You did not say how you were going to use the code and I am afraid I do not know about Bash scripts.

With the first example you may need to escape the ( & ) I use \( & \)

You could also try it without the resize first and see if that part works:

Code: Select all

convert IMG_9346.JPG -append IMG_9347.JPG -append IMG_9348.JPG -append append.png
With the second example I would try adding ( & ) with the escapes as well so it becomes \( & \)

Code: Select all

\( montage IMG_9346.JPG IMG_9347.JPG IMG_9348.JPG -tile x3 \) | convert -resize 645x2904 - tile.png
Again try the first part of the code then add the resize part later

Code: Select all

montage IMG_9346.JPG IMG_9347.JPG IMG_9348.JPG tile.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to make a photomontage?

Post by fmw42 »

try

convert image1 image2 ... image30 -background black -gravity center -append -resize "645x29040!" outputimage

see
http://www.imagemagick.org/script/comma ... php#append
http://www.imagemagick.org/script/comma ... php#resize
http://www.imagemagick.org/script/comma ... p#geometry

A bash script could be generated if you are on Unix, but we need to know how your images are actually numbered. Do they have leading zeros as image_0001 or image_1? Are they all the same size? If not what background do you want for the smaller ones. More details are needed.
Fafou

Re: How to make a photomontage?

Post by Fafou »

IT WORKS!

I'm on Ubuntu 8.04.2.
All the images have the same size.

I do: convert image1 .... image 30 -append -resize "645x29040!" Page_1.jpg and it works.
I'm just going to make a bash script with the name of the first image to insert, and with a for loop, Linux will do the rest. :p

Thank you everybody!
Fab
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to make a photomontage?

Post by anthony »

You do NOT need to -append after every image.

You can just read all the images in and then -append.

For example

Code: Select all

convert IMG_9346.JPG  IMG_9347.JPG  IMG_9348.JPG   -append   append.png
Also remember with the later releases of IM -append will also follow justification suggestions made by -gravity, at aleast for the direction perpendicular to the direction of the append. EG: horizontally.

If you like spaces bettwen the images you can also add a -splice or -border option before the append with the appropriate -bordercolor.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply