Down-sampling methods.


On this page you can find several examples of the effect that different downsampling methods have on image quality. The evaluations on this page focus mainly on the differences that common practices in Photoshop® (CS) have on the creation of aliasing artifacts. Methods, and alterative software, for reducing the tendency for such artifacts are also suggested.

For this evaluation I used a 1000x1000 pixel target with concentric cycles with a sinusoidal modulation from black (0) to white (255). The spatial frequency of the 'rings' ranges linearly from zero in the center, to one cycle (somewhat similar to 1 line pair) in the corner. The choice for a continuous tone target was made because it is a closer representation of a discrete quantization of a photographic image, such as from a scannner or digicam, than a bi-tonal pattern. Bi-tonal images, such as line drawings or to a certain extent text, may require different methods for optimal size reduction.

Rings1_small (52K) The small size version of the 'original' target as displayed on the left is for illustration purposes only. The actual resampling tests below, are based on the larger original. A copy of the original full 1000x1000 pixel size (1294 KB) target can be downloaded here.

As you may understand, it is theoretically impossible to accurately display detail that is smaller than 1 pixel. That means that if we reduce the size of the original target with its corner detail that cycles from black to white with each pixel, the average of several cycles per pixel should be represented by a shade of gray. Unfortunately that doesn't always happen. In fact, massive artifacting caused by aliasing is usually the result, as can be seen in the following examples.


Photoshop® CS, Image (index mode) Resizing to 20% with Resampling
Rings1_NN (53K)
Nearest Neighbor
Rings1_BL (53K)
Bilinear
Rings1_BC (53K)
Bicubic
Rings1_BCsm (53K)
Bicubic Smoother
Rings1_BCsh (53K)
Bicubic Sharper

As you can see above, and compared to the resized result below, the original target saved in a GIF file format doesn't resize as well as in an RGB (or Grayscale) file mode. That happens despite the fact that it has a full 256 shades palette table, so users are warned.

Because of that, all subsequent Photoshop® operations are performed after first converting to RGB mode.
Photoshop® CS, Image (RGB mode) Resizing to 20% with Resampling
Rings1_NNrgb (53K)
Nearest Neighbor
Rings1_BLrgb (35K)
Bilinear
Rings1_BCrgb (33K)
Bicubic
Rings1_BCsmrgb (30K)
Bicubic Smoother
Rings1_BCshrgb (35K)
Bicubic Sharper

You can see that all standard resampling methods in Photoshop® CS fail to avoid aliasing artifacts when downsizing. Granted, the target is hyper sensitive to aliasing because it has such a regular and high contrast pattern. However, there are software implementations that do a much better job 'out-of-the-box', although at the possible expense of being a bit slower (see ImageMagick™ examples below).
On most continuous-tone images with irregular detail the artifacts may be hard to detect, but the above examples show that they are present for all features smaller than 1 pixel in the end result, and as such in any down-sampled image. This may lead to enhanced visibility of graininess/noise (despite random placement), JPEG artifacts, scanned picture surface structure, or the aliasing of regular image structures like brick walls, especially when shot at an angle.

Now that we know that such small features need to be avoided, we can try and reduce high spatial frequencies before we downsize. I'll demonstrate two simple methods that will catch most of the trouble. The first method is by pre-blurring the image, thus gradually removing more detail as the spatial frequency increases. We can use a blur radius equal to the reduction factor of 5 x 0.2 = 1.0 .
Photoshop® CS, Gaussian Pre-Blur Radius 1.0, Image Resizing to 20% with Resampling
Rings1_GB10NN (41K)
Nearest Neighbor
Rings1_GB10BL (22K)
Bilinear
Rings1_GB10BC (21K)
Bicubic
Rings1_GB10BCsm (18K)
Bicubic Smoother
Rings1_GB10BCsh (21K)
Bicubic Sharper

For irregularly shaped subjects this will prevent most of the aliasing artifacts except for some pseudo detail from a few higher harmonics. This will probably be invisible for the majority of common images.
The somewhat square shaped area of higher contrast detail is what a perfect 'Sinc' filter would produce. The reason is that in a square pixel grid the diagonal resolution is approx. 41% higher than in the horizontal/vertical direction.

Now let's try a slightly more aggressive pre-blur, in the order of the reduction factor of 5 x 0.3 = 1.5 .
Photoshop® CS, Gaussian Pre-Blur Radius 1.5, Image Resizing to 20% with Resampling
Rings1_GB15NN (30K)
Nearest Neighbor
Rings1_GB15BL (17K)
Bilinear
Rings1_GB15BC (17K)
Bicubic
Rings1_GB15BCsm (15K)
Bicubic Smoother
Rings1_GB15BCsh (17K)
Bicubic Sharper

As we can see, the contrast of the higher harmonics is reduced, while the contrast of the high frequency detail is almost the same. A little small radius Unsharp Masking, or a High Pass sharpening layer will restore the fine detail contrast. Unfortunately, the border pixels were not fully blurred by Photoshop®, so some residual artifacts may require cropping on some images.

Another somewhat unorthodox method for reducing high spatial frequency detail, is by averaging/binning several pixels together with the Pixelate|Mosaic filter, before down-sizing.
Photoshop® CS, Mosaic Pre-filter at 5 pixels, Image Resizing to 20% with Resampling
Rings1_Mos5NN (35K)
Nearest Neighbor
Rings1_Mos5BL (35K)
Bilinear
Rings1_Mos5BC (31K)
Bicubic
Rings1_Mos5BCsm (29K)
Bicubic Smoother
Rings1_Mos5BCsh (32K)
Bicubic Sharper

Although much better than the unfiltered result, the amplitude of the higher harmonics is more visible than with the Gaussian preblur. Again, this may produce visibly quite pleasing results, but there is a somewhat higher chance of visible aliasing artifacts from some frequencies.

Finally I'll give an overview of some of the standard sampling filters of ImageMagick™, combined with the anti-aliased resizing provided by it. In my opinion, many of these pre-filters and the default anti-aliasing give superior results, compared to Photoshop®, and they also don't need prior conversion to RGB mode.
ImageMagick™ 6.0.0, Image Resizing to 20% with various Resampling filters
Rings1_IMcubic (4K)
Cubic
Rings1_IMquadratic (5K)
Quadratic
Rings1_IMgaussian (6K)
Gausssian
Rings1_IMbessel (5K)
Bessel
Rings1_IMhamming (7K)
Hamming
Rings1_IMmitchell (6K)
Mitchell
Rings1_IMtriangle (8K)
Triangle
Rings1_IMlanczos (5K)
Lanczos
Rings1_IMsinc (5K)
Sinc
Rings1_IMcatrom (7K)
Catrom
Rings1_IMhermite (8K)
Hermite
Rings1_IMhanning (9K)
Hanning
Rings1_IMblackman (12K)
Blackman
Rings1_IMbox (21K)
Box
Rings1_IMpoint (53K)
Point

Especially the Catrom, Sinc and Lanczos filtering give almost perfect, and well-behaved results for this type of image.

Concluding we can say that if a signal is not properly pre-filtered, a discrete sampled image in a regular grid will produce aliasing or Moiré when downsized. In order to suppress aliasing it is required to pre-filter the highest spatial frequencies with a low-pass filter. This low-pass filtering will result in reduced contrast, and thus visible resolution, of the finest detail, although with appropriate sharpening much of that can be restored.
The examples above use a very critical test target to simulate a real life scene, so the artifacts may be less visible with actual real life scenes, but the artifacts will be present nevertheless. If we want to avoid unpleasant surprises, it is a good thing to know what to look for and how to avoid it.


Top of page



You can reach me at this e-mail address with questions, remarks and suggestions about this page.

Designed by Bart van der Wolf Latest revision: 10-May-2004
Copyright © 2004, 2012, Bart van der Wolf