Saturday, January 16, 2021

Smooth Operations: Anti-Aliasing, Interpolation & Dithering

When it comes to creating illustrated imagery, one type of element that is important in every illustration, and is often taken for granted is an edge. In the non-digital illustration world edges are created by the physical use of an art material, but in the digital world, edges must be created in a virtual way to simulate a non-digital visual appearance. Image software programs like Adobe Photoshop provide both automated and user defined ways to manipulate or smooth an edge. So, as is the case with every aspect of a digital image, the illustrator has the ability to influence the look of edges in their work. It’s helpful to know how digital edges are rendered and displayed in order to do so.


Anti-Aliasing

A good explanation of anti-aliasing begins with a good description of display aliasing. Basically, aliasing is a jagged or stair-step appearance that is caused by a lack of resolution either by restrictions in a hardware device, such as a display, or file size limitations in a raster-based document. Anti-aliasing is the technique software designers have adapted to reduce or eliminate jagged edges by fooling the eye of the viewer. This is done by creating a diminishing series of shading steps between the edges of adjacent colors. See Below. Anti-aliasing is also referred to as “smoothing”.

Closeup of aliased stair step in red, anti-aliased smoothing in blue.
Aliased mountain rendering. © 2012 Don Arday.
Anti-aliased mountain rendering. © 2012 Don Arday.
Closeup of the anti-aliased edge of a rose petal.

Interpolation

Anti-aliasing occurs through the interpolation of picture elements, “pixels”. Think of interpolation as swapping and sharing. To improve the digital visual appearance of an image on our monitor the technique of interpolation is used. Let’s refer to the data in an image as a sample. To make the image display better, the computer converts the image to a higher sample by using filtering techniques like anti-aliasing. It may be no coincidence that the word interpolation bears a resemblance to interpretation, because that is sort of what occurs within anti-aliasing. The software in the case of a document, or the computer video card in the case of the display, interprets the color relationships when attempting to create a smooth transition between one color and another to render edge pixels. This generally occurs automatically, but illustrators can use manual methods to control the appearance of edges within their illustrations.

Dithering

Dithering is often confused with anti-aliasing, but it is actually something quite different. Dithering most often occurs in color image situations where colors in an image are out of the range of the colors available in an image display or output device. When this occurs the software program creates the unavailable color by mixing other colors that are available. For example, dithering can occur when a particular web browser does not support a specified color. The browser will then attempt to mix the requested color by “dithering” pixels by creating a combination from other colors it has available. Although usually invisible to the naked eye, dithering is done in the same manner as “noise” is, (see below) and like noise, it can appear slightly grainy in the extreme.

Some Manual Techniques

Feathering
Feathering is the softening of edges of adjacent shapes and colors within an image beyond the standard level of interpolation. Adobe Photoshop gives you the option to feathering selection edges in an image. A feathered edge results in increased edge blurring and a lowering of edge contrast between colors. With feathering, the artist has the ability to control the number of pixels to be included in a feathered edge. The result of feathering is similar to that of Gaussian blur. (See below.)

Gaussian Blur
Using Gaussian blur, or any of the other blur options in raster programs, means to force adjacent colors to drift into one and other creating a smoother edge transition. Colors in a Gaussian blur drift in a randomly distributed, non-linear manner. A motion blur option of the Gaussian blur limits the random color distribution to a particular direction. Blur can be used to redefine edges, and it can also be used to control the amount of focus in an image.

Gaussian blur applied to complimentary colors.
Gaussian blur closeup.

Noise
Noise is an exaggerated form of dithering. Although a controllable option in Photoshop, and a very useful one, noise, and specifically random pixel noise, is not necessarily thought of a s a good thing. Pixel noise is an unnatural, or unwanted, variation of value or color information in an image. Noise has a tendency to degrade sharp edges within an image by producing a scattered effect of random colored pixels. So a yellow flower against a blue sky may end up with blue pixels mixed among the yellow ones. And the flower and the blue sky might both have red pixels scattered in as well. See below. Photographers generally find noise to be very disturbing, however for the illustrator it may help to produce a desired, even naturalistic color effect. Noise is best applied as a final stage before publishing an illustration. And once saved an illustration that has had noise added is permanently altered, so it is always best to save your illustration prior to using noise, then save the noise applied version as a separate file.

Noise applied. Note the addition of other color pixels to the original pair 
of complimentary colors.
Noise closeup.

Sharpening
The three techniques discussed above can produce a smoothing appearance to an edge, but they also degrade its sharpness. Using a sharpening filter or “Unsharp Mask” in Photoshop can give the appearance of actually sharpening edges. Sharpen filters identify where dark and light edges meet in an image, and add contrast to those edges. The filter does this by creating an even darker line along the edge of a dark shape, and also a lighter line on the edge of an adjacent light shape. Unsharp Mask tends to move edges away from an anti-aliased appearance, and taken to far, sharpening can produce a very unnatural looking halo around shapes. See below. Sharpening like noise is best applied as a final stage before publishing an illustration.

Edge sharpening applied. Note the increased contrast at the edges of 
the two colors.
Edge sharpening closeup.

There are also some techniques in Photoshop for working with edges that rely on methods of selection like “Refine Edge” and “Fringe”, but the result of any of those actions uses the above basic methods of rendering.

By understanding how digital image edges are rendered and by using these manual options for refining them, you will have greater control over the appearance of your illustration either in print or on the monitor.

Thursday, January 14, 2021

Vector, Raster, and Vexel Defined

Digital illustrators use programs that are based on raster or vector interpretation of data, and all of us who have worked with Adobe Photoshop and Adobe Illustrator have experienced how different the workings of the two programs can be. Illustrator tends to be used more by illustrators and graphic designers that tend to focus more on object making. Illustrator is referred to as “object oriented” software. Photoshop tends to be used more by illustrators, photographers and designers who lean more toward making pictures. Of course these assumptions are not absolute, and the developers of both Illustrator and Photoshop have blurred the lines between raster and vector as they have evolved. This comes from each program attempting to provide a totally functional software solution. For instance, Illustrator uses some raster display effects and offers the user an option to rasterize elements and to use raster painting effects. Alternatively, Photoshop offers Bezier pen tool functionality, the option to use vector masks, and to create and save outlines. So with the cross adaptation between raster and vector, these software programs offer illustrators new options that didn’t exist a few years ago. And on top of all this, software programs like InDesign allow the use of both raster and vector components in a single document. One thing that can help illustrators and graphic designers make the decision as to which direction to go is to consider the purpose for the illustration, i.e., the software choice is determined by how the image must function. In order to make that decision an understanding of properties of raster, vector, and vexel imaging is indispensable.


Vector

Vector software is object oriented, a collection of objects that always retain their integrity. Straight and curved lines, gradients, and shapes including letterforms are an expression of mathematical descriptions. The positions, scale, and display attributes of all objects are noted mathematically using algebraic equations. Altering objects within an image results in an alteration of the mathematical data. This form of image processing preserves the integrity of the objects themselves. Because of this, there is no image degradation as a result of changing any of the objects attributes.  Even when an object, say a perfect circle, cannot be viewed properly on a monitor without some distortion, because monitors display in pixels (picture elements), the circle will exist as a perfect mathematical construct. And, with the right output device will appear so.


Illustrator vector file viewed in outline mode. © 2000 Don Arday.

Vector graphics are also referred to as “device resolution independent”, which is sort of an oxymoron. Although a vector document is dependent on a monitor or a printing device in order to be seen, the data itself always remains independent of any form of display or output. For instance, a vector image printed on a high-resolution 9600dpi printer will have a resolution of 9600dpi, and the same file printed on a low-resolution 300dpi printer, will have 300 as its resolution, and so on, but the original document data does not change.

Illustrator vector file viewed in preview mode. © 2000 Don Arday.

Vector files are much smaller than raster ones due to vector documents being based only on mathematical descriptions and not on pixels. For this reason vector files are extremely portable and very well suited to certain functions. Resizing a vector image is done by multiplying the mathematical description of the objects in the image by a scaling factor, so a file size of a vector illustrations will be the same whether it is output as a 3” x 4” spot illustration or it has been resized to be output as a 12’ x 16’ mural.

Strengths
Small, efficient file sizes.
Infinite scalability of images without a loss of quality.
Excellent type rendering, manipulating, and editing abilities.
Ability to apply mathematical operations to image components.
Accuracy in rendering geometric forms.
Ability to edit image elements.
Device resolution independent.

Weaknesses
Ability to render continuous tone full color images.
Ability to globally edit color brightness, contrast, hue, saturation and value.
Ability to apply editing filters to images.

Raster

Raster software is pixel oriented. Raster files are made up of individual picture elements, or pixels that are perfectly aligned arrays of color and value. Pixels run edge to edge, covering the entire surface of the image. Straight and curved lines, and shapes are all combinations of pixels. The size, position and attributes of parts of an image are all relative to their makeup in pixels.  The resolution or size of a raster illustration relates to, and is limited by, the number of pixels contained within it. As a side note, raster images display truly on monitors because both raster images and monitor displays are made of pixels, whereas monitors simulate vector images, which have no pixels.

Raster images are “device resolution dependent”. The output quality of an illustration is dependent upon the resolution required by the display or output device. This means that illustrators must know the intended function for their illustration in order to properly create it. For instance, a 3” x 4” Photoshop illustration for use on the web can be created at 72ppi (pixels per inch), and it would display smoothly, but the same file printed on a 1200dpi image setter would look jagged and “pixilated”. In other words, the pixels that make up the illustration would be conspicuous to the viewer making the image quality appear very poor. Conversely, that same 3” x 4” illustration created at 300ppi would print nicely, but used on the web, it would slow down or pause the loading of a webpage. Due to device resolution dependence images are not upwardly scalable. (See Digital Image Resolution a prior post for more information on scaling.)

Photoshop raster version enhanced by raster image operation editing. © 2000 Don Arday.

Raster files are much larger than vector files. This is because all the attributes, including the location and color of every single, individual pixel must be recorded, not to mention any saved operations or specialized layer data. All this can result in massive file sizes for raster illustrations; especially those that are created for high-resolution output devices.

Strengths
Ability to render continuous tone full color images.
Ability to globally edit color brightness, contrast, hue, saturation and value.
Ability to apply editing filters to images.

Weaknesses
Large file sizes.
Poor scalability of files.
Poor ability to render, manipulate, and output type.
Poor ability to generate geometric forms.
Device resolution dependent.

Vexel

Vexel art is where the style and method of rendering in vector based software programs is produced in a raster based environment. The term was coined by combining the words vector and pixel. As raster software programs like Adobe Photoshop have become more sophisticated they have incorporated vector based drawing tools such as bezier curve functions, shape generators, and text application functions. Therefore it is possible to get a vector art style appearance that is composed of pixels rather than objects. And it is possible to apply raster techniques to vector based components.

Strengths
Ability to render a vector style image in a raster environment.
Ability to use and combine both vector and raster operations in a single environment. 
Ability to render continuous tone full color images.
Ability to globally edit color brightness, contrast, hue, saturation and value.
Ability to apply editing filters to images.

Weaknesses
Large file sizes.
Poor scalability of files.
Limited vector style operations.
Device resolution dependent.