Page 1 of 1
Batch Montage onto 6x4 photo size
Posted: 2011-05-02T22:37:28-07:00
by SigilPhoenix
Hi all, first time here.
Version: ImageMagick 6.4.0 Q16, on a full Cygwin install on Win7.
I have approx 245 jpg images that are all the same size (roughly passport portrait, they're a little bit taller because I added photo names at the bottom).
What I would like to do is put every 4 images together in a grid on a 6"x4" canvas so that I can print them off later (I have 6x4 photo paper).
I had a look at the montage examples, but I couldn't quite figure out how to achieve this.
Thanks in advance.
EDIT: Oh, I definitely don't have an exact multiple of 4, what I will do is remove however many I need to from the end to make it 4 and do the remaining <4 myself manually, unless the script can easily handle that?
Re: Batch Montage onto 6x4 photo size
Posted: 2011-05-03T10:05:58-07:00
by fmw42
Sorry I am not clear on what you want to do. Is it just put 4 photos together in a 2x2 array in one photo and do it for all the your photos so that you have multiple montages of 2x2 images? Is your issue with making one montage or with trying to do all the photos at one time? The latter would require a script. Using montage on 4 photos is not very hard.
montage image1 image2 image3 image4 -tile 2x2 -geometry +X+Y -background white resultimage
This will put these 4 images into one picture as a 2x2 array with white spacing of X and Y between them.
see
http://www.imagemagick.org/Usage/montage/
Re: Batch Montage onto 6x4 photo size
Posted: 2011-05-03T15:13:18-07:00
by SigilPhoenix
Thanks for the reply.
My problems are writing the script, as you say it requires. Just one I can do, but scripting it I can't figure out.
My other issue is I want the 2x2 montage to roughly the size of a 6"x4" photo - can this be done, or do I just have to make sure the images are the right size to begin with and this will be dealt with automatically?
Re: Batch Montage onto 6x4 photo size
Posted: 2011-05-03T16:47:52-07:00
by fmw42
My other issue is I want the 2x2 montage to roughly the size of a 6"x4" photo - can this be done, or do I just have to make sure the images are the right size to begin with and this will be dealt with automatically?
You will need to figure out how big (WidthxHeight) your resulting 2x2 montage will be and then set the -density and -units appropriate for the output format (jpg or png, etc) to achieve a printable 6x4" size. You will need to set this after the montage as I don't see those as settings for the montage command at
http://www.imagemagick.org/Usage/montage/#settings
For example
montage in1 in2 in3 in4 ... miff:- | convert - -density XXxYY -units pixelsperinch resultimage.
Or create a temp file from montage and feed that to convert in a separate command.
see
http://www.imagemagick.org/script/comma ... hp#density and
http://www.imagemagick.org/script/comma ... .php#units (The default units are pixelsperinch, but note that png requires pixelspercentimeter, though if set properly IM can convert it for you)
Re: Batch Montage onto 6x4 photo size
Posted: 2011-05-03T19:06:46-07:00
by SigilPhoenix
Cheers!
Regarding automatically scripting it though to go through all the images (assume multiple of 4 images), I'm still scratching my head, any pointers?
Re: Batch Montage onto 6x4 photo size
Posted: 2011-05-03T19:44:28-07:00
by fmw42
SigilPhoenix wrote:Cheers!
Regarding automatically scripting it though to go through all the images (assume multiple of 4 images), I'm still scratching my head, any pointers?
Put all your filenames into an array. Then loop over the array with a skip of 4. Something like this, though not tested.
cd "$imagedir"
imgArr=(`ls "$imagedir"`)
imgcount=${#imgArr[*]}
k=0
for ((i=0;i<$imgcount;i=$i+4)); do
montage ${imgArr[$i]} ${imgArr[$i+1]} ${imgArr[$i+2]} ${imgArr[$i+3]} ... resultimage_$k.jpg
k=$(($k+1))
done
Re: Batch Montage onto 6x4 photo size
Posted: 2011-05-03T19:54:20-07:00
by SigilPhoenix
Thank you, much appreciated - I can work with that.
Re: Batch Montage onto 6x4 photo size
Posted: 2011-07-21T13:56:52-07:00
by PhoneFlea
First and foremost, I'd like to acknowledge that I'm aware of the age of this post. I just wanted to come on here to quickly thank all of your for your help. I'm attempting to create a collage of photos (much like SigilPhoenix here) in order to print them off. The issue is that I'm not very tech savvy and I'm very new to ImageMagick. With any luck, these suggestions and instructions will be super helpful. I'll let you all know when I'm done printing these photos off. That is. . .if I DO get them printed off. Take care, everybody!