Page 1 of 1

Windows Batch Crop

Posted: 2015-07-03T11:32:33-07:00
by lionelthomas
I am new to Imagemagick and command line processing.
I have scanned a batch of 60 photos 3 at a time into a folder named Xinput and now want to crop out and possibly rotate the photos into another folder named Xoutput. The following command seems to work to crop out one photo but how do I crop the other 2 in one pass.

mogrify -path Xoutput -crop 1174x1760+0+0 Xinput/*

Thanks

Re: Windows Batch Crop

Posted: 2015-07-03T11:36:46-07:00
by snibgo
I don't understand "60 photos 3 at a time". Does this mean you simply have 180 image files in that folder?

Do you want to give all these 180 images exactly the same crop and rotation?

Re: Windows Batch Crop

Posted: 2015-07-03T11:45:18-07:00
by lionelthomas
Each scan has 3 photos in it resulting in a jpg file with 3 photos in it. I want to crop and rotate the 3 photos into 3 separate files. 20 files in and 60 files out. Hope this explains better.

Re: Windows Batch Crop

Posted: 2015-07-03T12:09:17-07:00
by fmw42
Use mogrify 3 times on the same folder, each time using a different set of crop coordinates. Write the results to 3 different folders so you do not write over the images. Then rename the images as desired before combining them.

Re: Windows Batch Crop

Posted: 2015-07-03T12:31:15-07:00
by lionelthomas
Thanks, that would work except if I scan a roll of 36 photos they are now out of sequence. Is there a way to name the output files "rollnameXX1" where XX is photo number for the output folder 1 and so on. Then when I merge them into one folder they would be in sequence.

Re: Windows Batch Crop

Posted: 2015-07-03T13:11:01-07:00
by snibgo
If you want to change filenames, you can either do that part separately in a script that renames or copies or moves files, or do multiple (20 or 60) convert commands, probably in a loop in a script.

Re: Windows Batch Crop

Posted: 2015-07-03T13:21:47-07:00
by lionelthomas
Wow! This should be simple!! Where do I learn scripts? Seems like I have to become a programmer to use ImageMagick.

Re: Windows Batch Crop

Posted: 2015-07-03T13:28:38-07:00
by fmw42
mogrify only makes one output for each input image in the folder. So no way to name the output files. But if you do what I say, you get a folder for each crop with the same name as the input. All you need to do is rename the files in each folder with a -1, -2, -3 before the suffix, then put all the files into one folder.

There should be renaming tools in Windows or, if not, you can probably find some separate tools to do that by searching Google

Alternately, learn batch scripting for windows and just use a For loop. Some pointers can be found at http://www.imagemagick.org/Usage/windows/

Re: Windows Batch Crop

Posted: 2015-07-03T13:58:30-07:00
by lionelthomas
Thank you kindly. I will try that.

Re: Windows Batch Crop

Posted: 2015-07-03T14:45:04-07:00
by lionelthomas
Thank you, that worked famously.