Page 1 of 1

How to make a photomontage?

Posted: 2009-04-02T09:43:22-07:00
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

Re: How to make a photomontage?

Posted: 2009-04-02T10:42:08-07:00
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

Re: How to make a photomontage?

Posted: 2009-04-02T11:02:44-07:00
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.

Re: How to make a photomontage?

Posted: 2009-04-02T11:06:19-07:00
by fmw42
what is your IM version and are you on Unix or Windows? Are all the images the same size?

Re: How to make a photomontage?

Posted: 2009-04-02T11:09:28-07:00
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

Re: How to make a photomontage?

Posted: 2009-04-02T11:15:55-07:00
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.

Re: How to make a photomontage?

Posted: 2009-04-02T13:17:07-07:00
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

Re: How to make a photomontage?

Posted: 2009-04-07T20:17:42-07:00
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.