Resizing options

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
sim123

Resizing options

Post by sim123 »

What is the best option for image scaling (resizing) when I want good quality and good performance both at the same time?

Thanks for help and support.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Resizing options

Post by magick »

The -resize option without any filter or blur settings is the best compromise of speed and performance. To speed up resizing and while giving up just a little quality, use -scale. For pure speed use -sample or if you are generating small thumbnails, use -thumbnail.
sim123

Re: Resizing options

Post by sim123 »

Thanks for quick response, I am reading about resize option and it seems to working ok (I tried 2.5 mb image and its finished in 186 milisecond), I will try bigger images and post the results.

I have similar question here, I want to resize and image such that x and y dimensions are never greater than 200 pixels, so if I have 1057*2044 I want it to be resized to 200*200, I tried resize with ">" but it does not guarantee about both the dimensions, result image was 178*200 pixels.

Also if my image is like 1057*150, I want to scale it such that the new size will be 200*178 or if it is 130*1200 then it should be 130*200, how can I do that with IM? is it possible or do I need to right this logic by my own?

Thanks for all the help and support
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Resizing options

Post by Bonzo »

Have you read the resize options here ? http://redux.imagemagick.org/script/com ... php#resize
I have similar question here, I want to resize and image such that x and y dimensions are never greater than 200 pixels, so if I have 1057*2044 I want it to be resized to 200*200, I tried resize with ">" but it does not guarantee about both the dimensions, result image was 178*200 pixels.

Also if my image is like 1057*150, I want to scale it such that the new size will be 200*178 or if it is 130*1200 then it should be 130*200, how can I do that with IM? is it possible or do I need to right this logic by my own?
To get the image to 200x200 try:

Code: Select all

-resize 200x200!
To get the 1057*150 image to 200*178 try:

Code: Select all

-resize 200x178!
sim123

Re: Resizing options

Post by sim123 »

Thanks for the reply, I read about resize options and tried exact option, it seems to be working now.

Can anyone please tell me what interpolation method IM use by default to do resizing (reducing the size mainly).

Thanks for all the help and support.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resizing options

Post by fmw42 »

sim123 wrote:Thanks for the reply, I read about resize options and tried exact option, it seems to be working now.

Can anyone please tell me what interpolation method IM use by default to do resizing (reducing the size mainly).

Thanks for all the help and support.

See: http://www.imagemagick.org/script/comma ... php#filter

"If you do not select a filter with this option, the filter defaults to Mitchell for a colormapped image, a image with a matte channel, or if the image is enlarged. Otherwise the filter default to Lanczos."
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Resizing options

Post by Bonzo »

If you can run your code through php I have written a piece of code that will resize an image with all available filters. You can see which one you prefer then.

http://www.rubblewebs.co.uk./imagemagic ... filter.php
Post Reply