Summary: reducing (downsizing) natural images
Posted: 2012-08-10T07:38:26-07:00
Here is my overall take on viewtopic.php?f=1&t=20992 and some other threads (discussions tend to bleed between related topics). This is still evolving but I am fairly confident that what follows will survive additional investigation.
The following is most pertinent to the common sRGB to sRGB natural image reduction (or thumbnail production) but the main ideas should apply in general. This is probably is a good guide for synthetic (CG) images as well, but less testing has been done with those. Transparency channels may also complicate matters.
FOR BEST QUALITY
Note: There are shortcuts to some of the suggested parameter values. The above is meant to be tweakable, not concise.
The following is most pertinent to the common sRGB to sRGB natural image reduction (or thumbnail production) but the main ideas should apply in general. This is probably is a good guide for synthetic (CG) images as well, but less testing has been done with those. Transparency channels may also complicate matters.
FOR BEST QUALITY
Rule 1. Always go through linear light (RGB colourspace in ImageMagick): http://www.imagemagick.org/Usage/resize ... colorspace.
Heed the warning RE: older versions than IM6.7.5.
Rule 2. At equivalent sharpness/faithfulness, EWA (-distort resize) filters give better results (less moire, jaggies and halo) than orthogonal (-resize) filters.
Rule 3. Unless you are really averse to haloing, use the EWA Lanczos 3,4,5 family of Jinc-windowed Jinc filters. (LanczosSharp, LanczosRadiusN and LanczosSharpest are members of this family.) That is, chooseand run
- LOBES among 3,4,5 (maybe 2 if you really dislike haloing, in which case you probably should consider EWA Mitchell, Robidoux, Quadratic or Triangle instead of EWA Lanczos),
- BLUR between .7 and 1.0 (values between .88 to .95 generally work well),
- SIZE according to the syntax given in http://www.imagemagick.org/Usage/resize/#resize, for example WIDTHxHEIGHT,
A larger value of LOBES decreases moire (good) and jaggies (good), and increases halo (bad) and perceived sharpness (good).Code: Select all
convert INPUT.IMG -colorspace RGB -filter Lanczos -define filter:lobes=LOBES -define filter:blur=BLUR -distort Resize SIZE -colorspace sRGB OUTPUT.IMG
A smaller value of BLUR increases sharpness (good), moire (bad) and jaggies (bad).
When downsampling (downsizing), the exact value of BLUR appears to matter less than when upsampling (enlarging). For specific suggestions, see the aforementioned thread.
Disclaimer: What precedes is my personal opinion, and does not necessarily represent the opinions of others, including ImageMagick developers. Everyone is of course welcome to comment below.Rule 4. With well chosen parameters (which depend on content and personal preferences), you should not need to apply unsharp masking (USM) afterward, and things should look more natural than if you rely on USM to keep things sharp. At least, you should not have to USM as much to regain sharpness.
Note: There are shortcuts to some of the suggested parameter values. The above is meant to be tweakable, not concise.