Anti-Aliasing and Resampling Artwork - Part 2

By Gary David Bouton

Dateline: June 3, 2003
Volume 1, Number 6
Earlier columns
Computer Art Lessons forum

In the first part of this series, you took a look at anti-aliasing from the standpoint of how it works and what it can mean to the refinement of your artwork. This month, let's examine exactly how anti-aliasing works (hint: it's interpolation).

Interpolation and Averaging

Let's suppose you have a beautiful, miniature painting that is made up of only nine pixels, three pixels on a side. You decide that you want to make the image twice its original size (six pixels on a side), making it 36 pixels in total. There are three methods by which an application can "think up" new pixels to go into your image:

  • by creating pixels that are the nearest neighbor in color to the original pixel.
  • by sampling surrounding pixels in both a horizontal and vertical direction, and then creating a color average of the total sums for new pixels.
  • by sampling pixels in horizontal, vertical, and diagonal directions, and using a weighted average of the total colors for any given new pixel. Adobe Photoshop calls these three methods of interpolation nearest neighbor, bilinear, and bicubic interpolation. Other applications might have different names for these interpolations, but these are the three names we'll use here, as shown in the illustration below.

Nearest Neighbor
Nearest neigbor calculation isn't actually a method of interpolation. An application chooses the same color value for neighboring pixels in an enlarged image as the original color found at any given pixel. Therefore, if the center of our hypothetical 3 by 3-pixel painting is 50% black, and we enlarge the painting 200% through nearest neighbor calculation, the center of the painting would contain 4 pixels that are 50% black. No anti-aliasing is produced using nearset neighbor calculations because no color averaging – no new pixel colors – are added to the new image. You can see how this calculation is performed by a program in the illustration below. Nearest neighbor calculation is perfectly fine if your composition is rectangular in content, and you enlarge the image in multiples of two (200%, 400%, and so on). However, a more sophisticated procedure is required when working with large images that contain visual content which is organic and/or photographic, and you want to enlarge or reduce the image to, say, 148% of its original size. Most modern image editing applications offer something called bilinear interpolation, and the following section describes how it works.

Bilinear Interpolation
A single pixel in a painting that is enlarged using bilinear filtering gets its destination color from the top, left, right and bottom of its original position. These color readings of neighboring pixels are added together, divided by four, and the resulting color is applied to the new pixels in the image. In the next illustration, you can see how bilinear interpolation "looks" for new color information in our 3 by 3-pixel painting. Bilinear interpolation produces anti-aliased pixels within the new, enlarged image, because whole number values for new pixels are not possible. The resulting new pixels should, from an artistic as well as a mathematical point of view, represent blends or percentages, of neighboring pixels. Although bilinear interpolation produces good anti-aliased pixels, it is not the most sophisticated interpreting method for resizing images. Bicubic interpolation is covered in the following section.

Bicubic Interpolation
If we think of the nearest neighbor assignment of pixels as being a one-dimensional sampling technique, then bilinear interpolation would be a square function – it looks across two dimensions for pixel data. Bicubic interpolation goes one step further in calcualting new pixels. In this case, a pixel is assigned a new value based upon information taken in horizontal, vertical and diagonal directions, and then the sum is averaged with a preference for the predominating tones in the area, resulting in a weighted average. Bicubic interpolation is the most processor-intensive resizing method because it involves the most calculations, but the aesthetic results are also the most faithful to the original image. Whenever you resample an image, there will be some loss of focus within the image, but bicubic interpolation provides the sharpest of any method for creating new image data, or deleting and reassigning pixel colors. The illustration below shows how bicubic interpolation works. Of the three methods for creating or deleting pixels during resizing, only bilinear and bicubic interpolation produce anti-aliasing. If your computer has the horsepower, and your application offers interpolation choices, choose bicubic for the best results and then apply minor sharpening filtering, if you feel it's needed.

Progressive Changes and Anti-Aliasing

There is a problem with resampling an image, or image area, too many times, and this only partially has to do with anti-aliasing. Pixel-based images are constructed of a finite number of placeholders and whenever you change the total number of pixels, you create a change in the artwork. This type of change is a progressive one – as you resample, you build change upon change and there is no real path back to your original design. In the next illustration, you can see a close-up of a very small sphere design at the left. At the right, the sphere has been resized (resampled) twice and the result is an out-of-focus blob. You will not witness such a great amount of deterioration when you resample larger images, but the change in pixel count will still tend to throw the design out of focus, due to the averaging the application performs to add or discard pixels. The best strategy for keeping images you resample crisp in appearance is to know in advance what the final size of the image should be, and allow the application to interpolate the selected area only once.


Anti-aliasing is necessary for creating refined artwork, because pixels are rectangular in shape while the content of your artwork most likely is not rectangular. Anti-aliasing also reconciles the impossibility of a single pixel having more than one color value, by averaging the colors into a composite tone. Finally, anti-aliasing intelligently reassigns image pixel colors when you enlarge or reduce an image, so there are no abrupt color transitions creating artifacts in your work.

My Best,
Gary David Bouton

Discuss this column with Gary in the Computer Art Lessons forum.
Don't miss the next installment of this column. Get the free newsletter in your mailbox each week (and win great graphics products). Click here to subscribe.

Gary David Bouton is an author and artist who is largely responsible for the book "Inside Adobe Photoshop 7" and wouldn't mind at all if you bought a copy . Gary hosts a thread on the Photoshop Gurus site and is the moderator of a 3D modeling forum. His guide to Caligari's free trueSpace 3D app is available online. Besides being an educator/artist/all-around-nice-guy, Gary also wants to be a lighthouse keeper and plays with a flashlight on the front lawn at 3 a.m., much to the chagrin of his neighbors..