Genschman
Genschman

Reputation: 187

Montage (Image Magic) combine pictures via script

i need a little help to MONTAGE (ImageMagic):

How to combine 300 pictures in two separated folders?

Folder A includes pictures: a_001.png ... a_300.png

Folder B includes pictures: b_001.png ... b_300.png

I would like to combine a_001.png with b_001.png, a_002.png with b_002.png and so on.

How to solve this problem (i have no experience in scripting). I would prefer a small bash-script (linux), if necessary.

Thanks a lot

Upvotes: 0

Views: 605

Answers (1)

emcconville
emcconville

Reputation: 24439

for i in $(seq -f "%03g" 1 300)
do
    montage {A,B}/{a,b}_$i.png ab_out_$i.png
done

What's going on...

  • The for loop iterates from 1 to 300 with a zero-padding (e.g. 001 ... 300)
  • The {A,B} is a term wildcard, and will expand to..

    montage A/a_$i.png B/b_$i.png ab_out_$i.png
    
  • Montage will write out the result to ab_out_$i.png.

Upvotes: 1

Related Questions