Anti-aliasing is a word that’s thrown around by photographers and gamers when dealing with graphics card images. Take a look at what anti-aliasing is, why we use it, and most importantly, when it’s best to not use it.

It’s an important part of image making and photography—anti-aliasing is certainly something that should be understood as thoroughly as possible to create high-quality images. We hope you’re prepared for a very geeky article, as there will be lots of math.

You may remember an article from a year ago where we talked about the differences between vectors and pixels. Pixels are ordered arrays of light, pigment, or color, while vectors are mathematical representations of lines, shapes, gradients, etc. Vectors are precise. They exist as absolute functions on an algebraic grid. Because they are absolute, there’s no blurring the line between where they are and where they are not. Even if a monitor cannot render a line segment’s infinite thinness (it always has to show it in pixels), it still is as thin as a line existing only in a theoretical mathematical world.

That’s the problem with photography—light isn’t as precise as it would need to be to be capture in a perfectly mathematical way. Even if we developed cameras capable of reading the locations of individual photos with quantum precision as they hit the sensor, the weird nature of physics at the quantum level may cause individual particles to appear in multiple places on the sensor at the same time. This means it may be impossible to get the absolute location of that single particle of light. Photography is only an approximation of the light that is captured.

Pixels are handy because high-resolution images can approximate colors and shapes, very accurately recreating an image in a way that is similar to film-based photography. Even this is a form of anti-aliasing.

Interpolation: Creating Something from (Almost) Nothing

Digital photography is an approximation of the colors and values present when light hits a sensor—in this same way, anti-aliasing is an approximation of image data using a technique called “interpolation”. Interpolation refers to data created based on the trends of existing data. While it’s more complicated than simple guessing, there are formulas and proper methods for interpolation.

Computer-rendered checkerboards using varying kinds of anti-aliasing

When we look at these computer-rendered checkerboards, we can begin to understand what anti-aliasing is doing to improve and approximate images. On the leftmost image, there is no interpolation of data—the checkerboard is rendered in black and white pixels as it recedes back in perspective, and quickly becomes a mess. The visual errors and artifacts creates are what we call “aliasing”. The second and third images use different forms of anti-aliasing to better approximate how human eyes (and cameras) perceive light.

An image downsampled using nearest neighbor versus anti-aliasing interpolation

Those images, however, were a translation of absolute mathematical images into pixel-based images. How does anti-aliasing apply to your photography? When images are resized, either enlarged or reduced, the image is interpolated based on the data that exists in the image document. The left image is shrunk using the “nearest neighbor” resampling in Photoshop. In other words, it isn’t anti-aliased. The image on the right is reduced and anti-aliased, creating a much truer image at a smaller size.

Upsampled and anti-aliased image from above

Enlarged images also benefit from anti-aliasing. Keep in mind that when you’re upsampling (enlarging) images in a graphics program, you will never actually get more resolution out of a digital enlargement. Interpolation simply makes a good guess as to what should be there. Your edges will be soft and get softer as the photo is enlarged more and more.

A good rule of thumb is that you can always downsample (shrink) your images without loss of quality from anti-aliasing. Upsampling, however, makes the anti-aliasing very obvious, adds no new resolution, and should only be done if all other options are exhausted.

Anti-Aliasing and Vectors: Why Anti-Aliasing Makes Video Games Look Better

If you’ve played a PC game in the past 15 or so years, you might have seen video options that included settings for anti-aliasing. If you remember when we discussed vector shapes existing in absolute position, you should begin to understand why anti-aliasing is important to video games.

Three-dimensional forms are created in vector polygons, and these polygons exist in a math-only realm. Anti-aliasing in video games has at least two goals: First, it wants to be able to render the absolute, hard-edged lines of the polygons in a form that looks decent on a pixel-based monitor. Second, anti-aliasing better replicates the imprecise way that photography and human eyes perceive light.

Anti-Aliasing and Typography

On a final note, there are plenty of occasions where anti-aliasing is not ideal. If you’ve ever worked around graphic designers, you’re likely to have heard them complain about typography in Photoshop and how inferior it is to Illustrator, and they’re right!

Type that has been anti-aliased using multiple strategies

Both of the letters above are pixel-based typography, with the left being aliased and the right being anti-aliased. Neither are good representations of typography, or at least that typeface. It is acceptable to render a font on a screen with anti-aliasing, but for print, it can have some disastrous consequences.

Type on a can of Diet Coke

When you think about what letters are, they don’t really follow the same rules as digital photography. Letters are absolute shapes, better classified as vectors than pixel-based images. Depending on the type of printing process used to create them, the formulas behind these vector shapes become very important.

Type on a Pepsi advertisement

This image above was created with anti-aliased type, and then most likely offset printed. When we look closely, we can see why that’s bad.

A close-up of the Pepsi advertisement showing the poor effects of anti-aliasing on type

It becomes clear very quickly that these anti-aliased forms did not hold up well when printed this way. This is an example of how anti-aliasing is inferior to vector representations when printing typography. Of course, had this been an image, it would have held up quite well.

A close-up of type on the can of Diet Coke

Type, being an abstract medium, requires the precision of vectors to hold up under the kinds of printing processes that don’t use inkjet dots to create an image. Even at very close distances, we don’t see any dots or evidence that anti-aliasing went into the files used to print this Coke can.

Of course, most HTG readers won’t be offset printing most of their photos, so pixel-based typography printed from dot-based printers will work out just fine. Simply be aware of your anti-aliasing when you’re working with typography and when you’re working with photography—you’ll find you’re better prepared to make the right choices that will give you the best possible images.

If you have any questions regarding anti-aliasing and your photographs you feel we haven’t answered, or you think we’ve left something important out, feel free to let us know about it in the comments below.

Image credits: Varena #1 by Hasensaft, available under Creative Commons. Blurred umbrella portrait by Shannon, available under Creative Commons. Dragon Age 2 Demo Ogre VH by Deborah Timmins, available under Creative Commons. Anti-aliasing images by Loisel, available under GNU