Image Pairs

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
Alvin
Posts: 2
Joined: 2012-07-24T04:31:10-07:00
Authentication code: 15

Image Pairs

Post by Alvin »

Hello everybody!

I was wondering if anyone could help me with a question regarding the montage command for pairing images for an experiment. I would very much like to batch-concatenate images from two categories horizontally (1101_*.jpg and 1102_*.jpg). My question is how I could get Imagemagick to pick e.g 1101_001.jpg and 1102_001.jpg and store the composite image as 1101_001_1102_001.jpg and so forth. Essentially what I would need is to concatenate the two images and the two original image names into one image with a composite filename. The only viable solution, which is pretty greenhornish, I could come up with so far is :

>montage -mode concatenate -tile 2x1 image_*.jpg *.jpg

Would be very grateful for any kind of advice or reference to the imagemagick.org site. Many thanks in advance!

Alvin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image Pairs

Post by fmw42 »

I believe you probably need to write a script that loops through the pairs of images and simply +append them. The loop can extract the parts of the filenames you want via unix commands as variables and put them into the output name. At least this can be done in unix bash shell script. I am not a windows user so don't know how to do that in Windows. But see the links below.

http://www.imagemagick.org/script/comma ... php#append
http://www.imagemagick.org/Usage/layers/#append
http://www.imagemagick.org/Usage/basics/#mogrify_not
http://www.imagemagick.org/Usage/basics/#set
http://www.imagemagick.org/Usage/windows/
Alvin
Posts: 2
Joined: 2012-07-24T04:31:10-07:00
Authentication code: 15

Re: Image Pairs

Post by Alvin »

Thank you very much! I will definitely look into that!
Post Reply