Page 1 of 1

covert to specific width.

Posted: 2009-01-25T04:57:41-07:00
by DannyGM
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.

Re: covert to specific width.

Posted: 2009-01-25T15:33:44-07:00
by fmw42
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

Re: covert to specific width.

Posted: 2009-01-26T00:03:30-07:00
by DannyGM
Thank you.

I think that it's going to work.

I try it.

Re: covert to specific width.

Posted: 2009-01-26T19:21:00-07:00
by anthony
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.