Page 1 of 1

Resizes an image to a specific size and dealing with aspect

Posted: 2009-05-06T12:46:16-07:00
by vijayamaladoss
Hi,
I am trying to convert a image from 500X280 (16:9) to a specific box size of 377x248. I am using the resize and crop methodlogy and below is my command.

Code: Select all

convert 16_9.jpg -filter lanczos -resize 248x248^ -gravity center -crop 377x248+0+0 +repage 16_9_res.jpg
But the resultant images has the dimensions 248x139. I thought the idea of the above command to deal with aspect change and I saw the same things from Fred's script also.

http://www.fmwconcepts.com/imagemagick/aspect/index.php

Am I missing something ? Thanks a lot for your reply

PS: I am running on windows XP with ImageMagic 6.5.1-4 (Latest I think)

Re: Resizes an image to a specific size and dealing with aspect

Posted: 2009-05-06T13:26:34-07:00
by Bonzo
I would leave out the width in your case so -resize 248x248^ becomes -resize x248
Either way you need to escape the ^ with another ^ so it would be -resize 248x248^^
See http://www.imagemagick.org/Usage/api/

Try:

Code: Select all

convert 16_9.jpg -filter lanczos -resize x248 -crop 377x248+0+0 +repage 16_9_res.jpg

Re: Resizes an image to a specific size and dealing with aspect

Posted: 2009-05-06T16:18:39-07:00
by fmw42
try either

convert rose_tmp1.png -resize 248x248\^ -gravity center -crop 377x248+0+0 +repage rose_tmp2.png

or

convert rose_tmp1.png -resize '248x248^' -gravity center -crop 377x248+0+0 +repage rose_tmp2.png


If on windows: you must escape the ^ with another ^ rather than a \

Re: Resizes an image to a specific size and dealing with aspect

Posted: 2009-05-06T21:39:21-07:00
by vijayamaladoss
Wow, Thanks a lot for your quick reply. That worked as a charm :D