Hello.
I am using this:
convert src-img -resize 300X dest-img
to convert any image to 300px width.
My question is, how can I crop the "dest-img" image that it's will never be more than 500px height?
convert src-img -resize 300!X(max 500px)
Thank you.
covert to specific width.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: covert to specific width.
DannyGM wrote:Hello.
I am using this:
convert src-img -resize 300X dest-img
to convert any image to 300px width.
My question is, how can I crop the "dest-img" image that it's will never be more than 500px height?
convert src-img -resize 300!X(max 500px)
Thank you.
try:
convert src-img -resize '300x300^' -gravity center -crop 300x500+0+0 +repage dest-img
see http://www.imagemagick.org/script/comma ... p#geometry
if you are on windows, also see http://www.imagemagick.org/Usage/api/#windows
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: covert to specific width.
Almost that could still make the image width smaller that 300 pixels.
Use -resize 300x to gurantee 300pixel width, then use -crop to limit the height. or -extent to always set the height.
Use -resize 300x to gurantee 300pixel width, then use -crop to limit the height. or -extent to always set the height.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/