Page 1 of 1

Orientation dependent resizing

Posted: 2010-09-07T05:27:04-07:00
by mschipperheyn
Hi,
I would like to be able to use orientation dependent resizing. Since I don't know the widht x height of the image I'm feeding to ImageMagick, I would like ImageMagick to figure out the orientation and resize proportionally based on a max width of X in landscape and max height of Y in portrait.

Does anyone know how to do this?

Kind regards,

Marc

Re: Orientation dependent resizing

Posted: 2010-09-07T06:21:46-07:00
by Bonzo
Check out: http://www.imagemagick.org/script/comma ... php#resize
and : http://www.imagemagick.org/script/comma ... p#geometry

I think you want the standard -resize widthxheight without any options.

Re: Orientation dependent resizing

Posted: 2010-09-07T06:59:16-07:00
by anthony
Basically the default operation is to resize an image so it fits into the bound given as the resize argument, while preserving the images aspect ratio. Generally it means only one of the dimensions of the resulting image will match the dimension given.

Their are options (flags) that will make turn of aspect preservation, and force the image to become the size given exactly

or to make the image size so it the given dimensions just fits inside the result (minimal dimentions made to fit rather than maximum dimension.

See IM Examples Resize

Re: Orientation dependent resizing

Posted: 2010-09-07T11:05:05-07:00
by fmw42
-resize XxY will always look for the largest size and scale that to eithr XxY depending on whether width or height is larger and keep the aspect ratio. If you want to resize by the smaller dimension, then use the ^ flag. see all the resize options at http://www.imagemagick.org/script/comma ... p#geometry and examples at http://www.imagemagick.org/Usage/resize/#resize

see also my scripts aspect and aspectpad at the links below