Anti-Aliasing and Resampling Artwork - Part 1
By Gary David Bouton
I'd planned to discuss the fundamental differences between vector and bitmap graphics this month, but along the way I got a little carried away with one of the fundamentals of bitmap images: anti-aliasing. It's a fair enough topic for beginners and it's not a bad read for those of us who've been around the pixel once or twice. In the first of a two-part series, I'll begin by discussing the procedure by which art applications disguise the reality that diagonal lines and curves cannot be faithfully, artistically represented using rectangular pixels – "helper pixels" are required around the edge of such shapes. I'll take you through how anti-aliasing works, whether you're drawing a line or resizing a bitmap graphic.
"Aliasing" is the false presentation of visual data and is the result of an application rendering an image area without enough visual information. In the first illustration, you can see a spaceship at the top with an aliased outline – there are supposed to be curved and smooth diagonal lines around its outline, but instead there are stairsteps. "Anti-aliasing", shown applied to the same spaceship at the bottom, is a method for accurately representing image data.
Image Resolution and Granularity
When this checkerboard scene is rendered by a computer application to bitmap format, the application performing the rendering has two choices to make: to alias the horizon – to choose either white or black at any given pixel – or to anti-alias – to average the color for a given pixel, to create an image area closer to the way a human eye would see the actual scene. In the illustration above, imagine that the square next to the call-out is a single pixel, a pixel whose size cannot change and can contain only one color.
The visual content at this point in the picture, however, consists of more than one color – there can be a number of white and black squares close to the horizon – with only a single image pixel to represent them. So, what's it going to be: a black or a white pixel? To make such a decision is called aliasing; if you fill this pixel with white, you're negating the black squares within this sample area. To reconcile the impossibility of filling a single pixel with more than one color, anti-aliasing of the scene fills the pixel with a shade of black, because in reality the pixel sample area should contain a blend of both black and white sample information. Anti-aliasing can be added to artwork by most graphics applications on three occasions:
Anti-aliasing and Brush Strokes
In the illustration below you can see a pair of diagonal lines; the one at left has several pixels of different opacity that "fill in" the abrupt edges where the line is not perfectly parallel to the grid of pixels that make up the image. At right, an aliased version of the diagonal line shows harsh, unappealing "stairsteps".
A fair question at this point would be, "How does the application know where to put the different anti-aliased pixels? The answer lies in averaging image area tones, and interpolating the correct shade of pixel to lie on the edge of the line or curve. We'll get into the various methods of interpolation next month. In the next illustration you can see a close-up of a rounded shape, with and without anti-aliasing. At a close view, the outline of the anti-aliased shape looks fuzzy, but at 1:1 viewing resolution the curve is both crisp and soft.
If you zoom very closely on a diagonal line with anti-aliased edges, you will observe the following phenomenon: pixels at the edge of the line gradually are composed of less line color and more image background color the farther a pixel is from the line. Below you can see callouts for the percentage mixture of anti-aliased pixels on the edge of a vertical line.
The idea behind anti-aliasing a shape you create is to make a smooth transition between the interior of a shape and its background. Besides the anti-aliasing that goes on in modeling and painting programs, there is a third type of anti-aliasing that occurs when you resize a bitmap image. Next month I'll cover the different sorts of interpolation ("interpretation") graphics apps use to make the resizing of an image come out more smoothly. I'll also tell you what sort of image editor you might want to buy, to make sure that product X can do bicubic interpolation, for example.
But I'm getting a month ahead of myself.
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 has the largest bottle cap collection on the East Coast, and wants to be Scott Turow (or at least Mr. Turow's bank account) when he grows up.