Understanding Dithering


Dithering, which applies only to GIF images, is one of those big bugaboos that is constantly argued about on Usenet. Dithering , put simply, is a process of constructing the color for a single pixel from a combination of the colors in surrounding pixels. You may remember from school how blue and yellow, when mixed together, give you green. Color mixing is the principle behind dithering.

In practice, dithering is quite complex. There are several mathematical functions available when dithering images. One of these is known as diffusion (see Figure 42.21). Which dithering processes are available with your software depends on which program you're using. Just as you must decide in which format to save your files, you must also select which dithering process to use. I suggest experimenting with several settings to see which method best suits a particular image. In Paint Shop Pro, the dithering choice (diffusion vs. no dither- nearest color) is made when you decrease the color depth of an image.

Figure 42.21. Sixteen-color image reduced with diffusion dithering.

graphics/42fig21.gif

Image software, be it your graphics program or your browser, resorts to dithering when it cannot display the entire color palette of an image. The results can vary. Figure 42.19 is an image that hasn't had its reduced.

Figure 42.19. Twenty-four “bit image.

graphics/42fig19.gif

Figure 42.20 is the same image reduced to 16 colors (or 16 levels of gray, if you will). No dithering has been applied.

Figure 42.20. Sixteen-color image with no dithering.

graphics/42fig20.gif

Notice the distinct banding within the sky and its reflection in Figure 42.20. Without the help of dithering, the process to reduce the number of colors must choose a nearest match (what Paint Shop Pro calls "nearest color"). On the other hand, the diffusion method of dithering was applied to Figure 42.21 during color reduction, with perhaps better results.

Some people may regard the speckling, which is a result of the dithering, as unacceptable. You'll have to decide how to handle this problem when it comes to designing your own Web graphics. If you're going to display 256-color images that were created as 24-bit images, you'll have to decide whether to dither. One option is to choose colors that closely match those available in the palette with which the images will ultimately be displayed.



Sams Teach Yourself Internet and Web Basics All in One
Sams Teach Yourself Internet and Web Basics All in One
ISBN: 0672325330
EAN: 2147483647
Year: 2003
Pages: 350
Authors: Ned Snell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net