resize with @ option, but skip small images

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
sergeymk

resize with @ option, but skip small images

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: resize with @ option, but skip small images

Post by anthony »

Have you tried adding a '>' (resize larger images only) with the '@'?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
sergeymk

Re: resize with @ option, but skip small images

Post by sergeymk »

yes I tried, but it does not work.

it gives different errors depending on whether I escape it or not.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: resize with @ option, but skip small images

Post by anthony »

Well it has to be escaped or it will be treated as a shell meta-character. What is the other error?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
sergeymk

Re: resize with @ option, but skip small images

Post 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!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: resize with @ option, but skip small images

Post by anthony »

I'll make a not of that windows this in the IM Examples API's and scripting section.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply