Hi. I have written this command to resize, correct levels and rename all the files in the pics1 folder to the pics2 folder.
convert pics1\*.jpg -resize 3000000@ -auto-level -quality 95 -set filename:f %f pics2\z_%[filename:f]
The resizing is based on a fixed megapixels data. What I'd like to know is how to prevent images with a lower size in megapixels from being resized. I've read the docs and noticed you can use < for that, but it seems it doesn't work with areas. I could use previous commands like identify -format %w file.jpg and identify -format %h test.jpg to calculate the size in megapixels but that would complicate everything. Any idea?
Thanx.
Resize to area, but not if images are smaller
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Resize to area, but not if images are smaller
Looking at the code. Area does not make use of those flags.
By the look of it the Area flag only will cause an image to shrink, if the calculated size for that number of pixels
will cause the image to shrink. It will not enlarge images to have at least that many pixels.
The library function documentation says "@ Fit image to contain at most this many pixels" so that makes sense.
In otherwords it implies a '>' flag usage (resize larger images). That is what you are wanting is it not!
Strange, that is not what I see happening in my own small test! It is resizing images smaller and larger!
Also as the code is after the '<' '>' flag tests those flags can not modify the results.
This may be a bug!
Code handling this behaviour is in bottom part of ParseMetaGeometry(), in "magick/geometry.c".
By the look of it the Area flag only will cause an image to shrink, if the calculated size for that number of pixels
will cause the image to shrink. It will not enlarge images to have at least that many pixels.
The library function documentation says "@ Fit image to contain at most this many pixels" so that makes sense.
In otherwords it implies a '>' flag usage (resize larger images). That is what you are wanting is it not!
Strange, that is not what I see happening in my own small test! It is resizing images smaller and larger!
Also as the code is after the '<' '>' flag tests those flags can not modify the results.
This may be a bug!
Code handling this behaviour is in bottom part of ParseMetaGeometry(), in "magick/geometry.c".
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/