Page 1 of 1

Resize, crop, and splice multiple image files

Posted: 2016-09-29T11:30:57-07:00
by ibacbea
I have 10 images in the same folder:

01.jpg
02.jpg
...
10.jpg

I need a batch file to do the following:

1) Resize all to 1800(w)x1200(h)px.
2) Split all images horizontally (1800x600px) to create a top and bottom half of each image (top01.jpg, bot01.jpg...,top10.jpg, bot10.jpg).
3) Merge halves to create 10 new 1800x1200px images with the following combinations: top01/bot02, top02/bot03,..., top09/bot10, top10/bot01.
4) New files should be named new01, new02, etc. to the same origin folder.

Step 2 doesn't actually need to save the halves as long as the new images in Step 4 have the desired result.

Thanks in advance.

Re: Resize, crop, and splice multiple image files

Posted: 2016-09-29T11:45:27-07:00
by Bonzo
What have you tried?

Try doing one image a step at a time and when you have done that you can then move onto the multiple images.

This forum is to help people with their code not to write their code for them.

Re: Resize, crop, and splice multiple image files

Posted: 2016-09-29T11:50:09-07:00
by fmw42

Re: Resize, crop, and splice multiple image files

Posted: 2016-10-03T10:50:00-07:00
by ibacbea
magick "C:\Program Files\ImageMagick\images\01.jpg" -crop 1800x600 "C:\Program Files\ImageMagick\images\half01.jpg"
magick "C:\Program Files\ImageMagick\images\02.jpg" -crop 1800x600 "C:\Program Files\ImageMagick\images\half02.jpg"
magick "C:\Program Files\ImageMagick\images\03.jpg" -crop 1800x600 "C:\Program Files\ImageMagick\images\half03.jpg"
magick "C:\Program Files\ImageMagick\images\04.jpg" -crop 1800x600 "C:\Program Files\ImageMagick\images\half04.jpg"
magick "C:\Program Files\ImageMagick\images\05.jpg" -crop 1800x600 "C:\Program Files\ImageMagick\images\half05.jpg"
magick "C:\Program Files\ImageMagick\images\06.jpg" -crop 1800x600 "C:\Program Files\ImageMagick\images\half06.jpg"
magick "C:\Program Files\ImageMagick\images\07.jpg" -crop 1800x600 "C:\Program Files\ImageMagick\images\half07.jpg"
magick "C:\Program Files\ImageMagick\images\08.jpg" -crop 1800x600 "C:\Program Files\ImageMagick\images\half08.jpg"
magick "C:\Program Files\ImageMagick\images\09.jpg" -crop 1800x600 "C:\Program Files\ImageMagick\images\half09.jpg"
magick "C:\Program Files\ImageMagick\images\10.jpg" -crop 1800x600 "C:\Program Files\ImageMagick\images\half10.jpg"
magick "C:\Program Files\ImageMagick\images\half01-0.jpg" "C:\Program Files\ImageMagick\images\half02-1.jpg" -append "C:\Program Files\ImageMagick\images\new01.jpg"
magick "C:\Program Files\ImageMagick\images\half02-0.jpg" "C:\Program Files\ImageMagick\images\half03-1.jpg" -append "C:\Program Files\ImageMagick\images\new02.jpg"
magick "C:\Program Files\ImageMagick\images\half03-0.jpg" "C:\Program Files\ImageMagick\images\half04-1.jpg" -append "C:\Program Files\ImageMagick\images\new03.jpg"
magick "C:\Program Files\ImageMagick\images\half04-0.jpg" "C:\Program Files\ImageMagick\images\half05-1.jpg" -append "C:\Program Files\ImageMagick\images\new04.jpg"
magick "C:\Program Files\ImageMagick\images\half05-0.jpg" "C:\Program Files\ImageMagick\images\half06-1.jpg" -append "C:\Program Files\ImageMagick\images\new05.jpg"
magick "C:\Program Files\ImageMagick\images\half06-0.jpg" "C:\Program Files\ImageMagick\images\half07-1.jpg" -append "C:\Program Files\ImageMagick\images\new06.jpg"
magick "C:\Program Files\ImageMagick\images\half07-0.jpg" "C:\Program Files\ImageMagick\images\half08-1.jpg" -append "C:\Program Files\ImageMagick\images\new07.jpg"
magick "C:\Program Files\ImageMagick\images\half08-0.jpg" "C:\Program Files\ImageMagick\images\half09-1.jpg" -append "C:\Program Files\ImageMagick\images\new08.jpg"
magick "C:\Program Files\ImageMagick\images\half09-0.jpg" "C:\Program Files\ImageMagick\images\half10-1.jpg" -append "C:\Program Files\ImageMagick\images\new09.jpg"
magick "C:\Program Files\ImageMagick\images\half10-0.jpg" "C:\Program Files\ImageMagick\images\half01-1.jpg" -append "C:\Program Files\ImageMagick\images\new10.jpg"

Any way to avoid saving the "half" images and skip right to the final result?

Re: Resize, crop, and splice multiple image files

Posted: 2016-10-03T10:55:28-07:00
by GeeMack
ibacbea wrote:Any way to avoid saving the "half" images and skip right to the final result?
Open a command prompt, navigate into the directory where those images are, make sure there aren't any other JPG images in that directory, ones you don't want included in the processing, and try this...

Code: Select all

magick *.jpg -resize 1800x1200! -roll +0+600 -append -roll +0-600 -crop 1800x1200 -scene 1 new%02d.jpg