I'm trying to get the following command to work on Server 2003 using an ImageMagik tool called mogrify.
for %G in (.jpg, .png, .gif) do forfiles /p "C:\Images" /s /m *%G -d 0 -c "cmd /c C:\ImageMagick\mogrify.exe -resize 800x800^> -quality 80 -strip @path"
But when the mogrify tool runs for the found path it errors saying the resize arg is invalid.
mogrify.exe: InvalidArgument `80Ã╬0>': -resize @error/mogrify.c/MogrifyImageCommand/5754.
I believe the problem relates the value and that it contains ^>.
The > symbol is needed to tell the tool to only downscale either width or height and I think the ^ is needed as an escape character.
Independently the command does work and the image is resized:
mogrify.exe -resize 800x800^> -quality 80 -strip "image1.jpg"
Also the command works if I remove the resize arg but of course the images are not resized:
for %G in (.jpg, .png, .gif) do forfiles /p "C:\Images" /s /m *%G -d 0 -c "cmd /c C:\ImageMagick\mogrify.exe -quality 80 -strip @path"
I've also tried variations by wrapping the value with double-quotes and escaping the ^ multiple times but nothing seems to work.
For whats worth I can get the following to work but removing ^ and adding quotes from the resize value.
cmd /c C:\ImageMagick\mogrify.exe -resize "800x800>" -quality 80 -strip image1.JPG
So to summaries how do i correctly add the resize value of 800x800> to the following command?
for %G in (.jpg, .png, .gif) do forfiles /p "C:\Images" /s /m *%G -d 0 -c "cmd /c C:\ImageMagick\mogrify.exe -resize 800x800^> -quality 80 -strip @path"