Page 1 of 1

resize with @ option, but skip small images

Posted: 2008-02-03T12:36:17-07:00
by sergeymk
Hi!

ImageMagick is so perfect in every way, except when (batch) resizing images to a given pixel area (with "@" option), it is impossible to skip images that are smaller than the given area.

I use this to downsize photos, but I don't want to enlarge photos that are already small:

Code: Select all

mogrify -resize 1333000@ -unsharp 0x0.5 -quality 95% *.jpg

Re: resize with @ option, but skip small images

Posted: 2008-02-03T18:06:02-07:00
by anthony
Have you tried adding a '>' (resize larger images only) with the '@'?

Re: resize with @ option, but skip small images

Posted: 2008-02-03T18:36:04-07:00
by sergeymk
yes I tried, but it does not work.

it gives different errors depending on whether I escape it or not.

Re: resize with @ option, but skip small images

Posted: 2008-02-03T18:38:41-07:00
by anthony
Well it has to be escaped or it will be treated as a shell meta-character. What is the other error?

Re: resize with @ option, but skip small images

Posted: 2008-02-04T18:22:26-07:00
by sergeymk
I got it!

Code: Select all

mogrify -resize 1333000@^> -unsharp 0x0.5 -quality 95% *.jpg
I was escaping with backslash ( \ ), per examples in manual pages. But in Windows one must escape with ^.

Output is resized only when source image is larger than given area!

Thanks a lot for your time!

Re: resize with @ option, but skip small images

Posted: 2008-02-04T19:30:44-07:00
by anthony
I'll make a not of that windows this in the IM Examples API's and scripting section.