Page 1 of 1

Combine/stack convert.exe commands

Posted: 2013-11-13T08:26:15-07:00
by Win7
I'm currently running convert.exe 3 times to generate 3 different crops from 1 image:

Code: Select all

convert.exe -resize 800 -unsharp 0x0.75+0.75+0.008 -gravity center -crop 800x533+0+0 +repage OrigFile OutputFile1
convert.exe -resize 800 -unsharp 0x0.75+0.75+0.008 -gravity North -crop 800x533+0+0 +repage OrigFile OutputFile2
convert.exe -resize 800 -unsharp 0x0.75+0.75+0.008 -gravity South -crop 800x533+0+0 +repage OrigFile OutputFile3
These all work perfectly well, though the problem is I have to run convert.exe 3 times for every image. How would I launch it once and have it do all 3 crops at one go? The only difference is the -gravity.

I am on Windows 7, and I am launching convert.exe from another program. I can either use either the command-line or read commands from a file, no prob. Input and output files are all jpg. Would appreciate the correct syntax to "stack" these commands.

TIA

Re: Combine/stack convert.exe commands

Posted: 2013-11-13T08:48:31-07:00
by snibgo
The input file, OrigFile, should be placed before all those options, not after. This not only runs convert 3 times, but reads the input 3 times, resizes 3 times and unsharps 3 times.

As one command, something like this:

Code: Select all

convert.exe ^
  OrigFile ^
  -resize 800 -unsharp 0x0.75+0.75+0.008 ^
  ( +clone -gravity center -crop 800x533+0+0 +repage -write OutputFile1 +delete ) ^
  ( +clone -gravity North -crop 800x533+0+0 +repage -write OutputFile2 +delete ) ^
  -gravity South -crop 800x533+0+0 +repage OutputFile3

Re: Combine/stack convert.exe commands

Posted: 2013-11-13T09:28:53-07:00
by Win7
Hi snibgo, that works exactly as I wanted. Thanks so much! :-D