Page 2 of 2
Re: Newbie Batch Processing Question
Posted: 2011-01-12T11:25:54-07:00
by OldBoy
Hi Bonzo and fmw42 - thanks for your time
Bonzo: I tried the code - The only response I got was '%%f was unexpected at this time."
fmw42: The version I am using is 6.6.7 Q16, which is the latest version (if I understand it right)
Re: Newbie Batch Processing Question
Posted: 2011-01-12T11:39:59-07:00
by fmw42
Bonzo will have to help further as I know little about windows and IM under windows and windows bat file programming. I use Mac OSX with unix bash shell programming. Sorry.
Re: Newbie Batch Processing Question
Posted: 2011-01-12T12:04:39-07:00
by OldBoy
fmw42 wrote:Bonzo will have to help further as I know little about windows and IM under windows and windows bat file programming. I use Max OSX with unix bash shell programming. Sorry.
Thanks anyway fmw42
Re: Newbie Batch Processing Question
Posted: 2011-01-12T14:25:33-07:00
by Bonzo
AH ha I had that error when I was not thinking - you pasted the convert comand into the command prompt box.
You need to save my code example as a bat file somewhere; I put it in the my user folder Anthony.
The images were in a folder called crop_test on my desktop and so the comand to run that is:
C:\Users\Anthony\crop.bat C:\Users\Anthony\Desktop\crop_test C:\Users\Anthony\Desktop\crop_test
First part is the path to the batch script: C:\Users\Anthony\crop.bat
The second is the path to the folder with the images to process: C:\Users\Anthony\Desktop\crop_test
The third is the path to save the images to: C:\Users\Anthony\Desktop\crop_test
Do not forget to cd\ back to the c prompt in the comand window before running the command.
For testing I just created a tempory folder and copied a couple of photos into it and saved the cropped images back to the same folder.
Re: Newbie Batch Processing Question
Posted: 2011-01-12T15:09:40-07:00
by OldBoy
Bonzo wrote:AH ha I had that error when I was not thinking - you pasted the convert comand into the command prompt box.
You need to save my code example as a bat file somewhere; I put it in the my user folder Anthony.
The images were in a folder called crop_test on my desktop and so the comand to run that is:
C:\Users\Anthony\crop.bat C:\Users\Anthony\Desktop\crop_test C:\Users\Anthony\Desktop\crop_test
First part is the path to the batch script: C:\Users\Anthony\crop.bat
The second is the path to the folder with the images to process: C:\Users\Anthony\Desktop\crop_test
The third is the path to save the images to: C:\Users\Anthony\Desktop\crop_test
Do not forget to cd\ back to the c prompt in the comand window before running the command.
For testing I just created a tempory folder and copied a couple of photos into it and saved the cropped images back to the same folder.
Thanks Bonzo!!!
Re: Newbie Batch Processing Question
Posted: 2011-01-20T13:37:42-07:00
by haleg
Did you ever get it working? I have been working in DOS batch for a bit, the FOR command is quite particular in its processing particularly with environment variables %1, %2 in a batch file. Give a response back, and I will be checking.
FYI, I tried your command, and you don't seem to need the %d on the output file name. IM CONVERT adds the number automatically.
Re: Newbie Batch Processing Question
Posted: 2011-01-20T13:42:51-07:00
by Bonzo
Thanks for the info about the filename and %d
Re: Newbie Batch Processing Question
Posted: 2011-01-20T14:13:05-07:00
by haleg
The double-quotes in the output are good, and I would suggest putting the input directory (%1) in quotes also.
for %%f in ("%1\*.png") do ( convert "%%f" -crop 128x128 +repage "%2\%%~nf.png" )
[quotes added to input-control][removed '_%%d' as it is not needed]
With this you should be able to have any input directory or output directory, spaces or not.
Re: Newbie Batch Processing Question
Posted: 2011-02-04T08:31:58-07:00
by tg3793
You would use the "mogrify" command instead. That would keep the file name exactly the same:
http://www.imagemagick.org/www/mogrify.html
Re: Newbie Batch Processing Question
Posted: 2011-02-06T01:08:45-07:00
by anthony
OldBoy wrote:Well, it looks like it isn't a quad cut that I need, just equally sized divisions.
for equal sized divisions try the newer
Cropping into roughly Equally Sized Divisions
http://www.imagemagick.org/Usage/crop/#crop_equal
Specifically -crop 2x2@
If the image is an odd size, it will make the left/top images one pixel larger. It only ever generates a 1 pixel size for any number divisions.