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)
Newbie Batch Processing Question
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Newbie Batch Processing Question
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.
Last edited by fmw42 on 2011-01-12T12:53:37-07:00, edited 1 time in total.
-
- Posts: 8
- Joined: 2011-01-11T14:13:36-07:00
- Authentication code: 8675308
- Location: Oxfordshire, UK
Re: Newbie Batch Processing Question
Thanks anyway fmw42fmw42 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.
Re: Newbie Batch Processing Question
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.
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.
-
- Posts: 8
- Joined: 2011-01-11T14:13:36-07:00
- Authentication code: 8675308
- Location: Oxfordshire, UK
Re: Newbie Batch Processing Question
Thanks Bonzo!!!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.
Re: Newbie Batch Processing Question
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.
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
Thanks for the info about the filename and %d
Re: Newbie Batch Processing Question
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.
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
You would use the "mogrify" command instead. That would keep the file name exactly the same:
http://www.imagemagick.org/www/mogrify.html
http://www.imagemagick.org/www/mogrify.html
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Newbie Batch Processing Question
for equal sized divisions try the newerOldBoy wrote:Well, it looks like it isn't a quad cut that I need, just equally sized divisions.
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/