Best ImagMagick resize settings for resizing photos

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?".
Posts: 37
Joined: 2008-09-01T08:31:26-07:00

Best ImagMagick resize settings for resizing photos

Post by davidb2002 »

I have been using the following imagmagick command for quite sometime. However, we have noticed there is some blur from it and would like to sharpen the result.

Code: Select all

-resize "1000x1000>" -quality 100
So, we would like to know what is the best way to resize photos that may be quite large down to 1000pixels and keep the original sharpness as much as possible?

User avatar
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Best ImagMagick resize settings for resizing photos

Post by fmw42 »

That is a tough question that has been the topic of many discussions in the Image Processing forum. The results of which have been coded into IM. You have many -filter options to choose as well as -defines to blur or sharpen. All of this is discussed in detail at with some recommendations/rationalizations for the defaults for upsizing as well as downsizing. So the arguably "best" choices in general have been made the defaults. However, they have changed over time as Nicolas Robidoux and Anthony have developed and tested different filters. See also the discussions at viewforum.php?f=22

I think you may have to use the -filter and -defines for your own testing for your kinds of images to figure out what is best for you.

I will certainly defer to Anthony and Nicolas on this topic.

User avatar
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Best ImagMagick resize settings for resizing photos

Post by anthony »

Resize results are pretty well all subjective.

What looks good for one person, is not necessarily good for another person.
Basically their is no 'mathematical metric' that can tell you if some filter is better than another.
This is a chicken-egg problem. You can not compare results with a "perfect resize" because their is no such thing as a perfect resize! You can only do subjective (test group) comparisons.

Typically however the defaults are 'reasonable' and generally accept as being good by various experts.

You can try different filters (some sharper, some with ringing, some blocky or producing aliasing effects)
See Resize artifacts

You can try the photoshop method of doing a resize and then a small 'unsharp' image sharping operation.
See Sharpen Resized Images, whcih compares 'filter sharpen, against post resize unsharpen)
ASIDE: unsharp is a simpler (faster, though not by much) technique than true sharpen technique.
See 'Un-sharpen' Images using Blurs
Verses: Sharpening Images with Edge Detection

Also you can do from the typical 2-pass linear filtering to a 1-pass cylindrical (elliptical or EWA) filtering method that often produes better (less blocky and aliased) diagonals. but is also much slower.
See Distort Resize vs Resize
Anthony Thyssen -- Webmaster for ImageMagick Example Pages