Section 29.2. LZW Compression


29.2. LZW Compression

The GIF format uses LZW (Lempel-Zev-Welch) compression, which takes advantage of repetition in data streams. Translated into graphic terms, this means that LZW compression is extremely efficient at condensing strings of pixels of identical color. To use an extremely simplified example, when the compression scheme encounters a row of 15 identical blue pixels, it makes up a shorthand notation that means "15 blue pixels." The next time it encounters 15 blue pixels, it uses only the code shorthand. By contrast, when it encounters a row that has a gentle gradation from blue to black, it needs to store a description for every pixel along the way, requiring more data. This is why GIFs are efficient at storing simple graphical images; the areas of flat color take advantage of the LZW compression.

One of the advantages of LZW compression is that it is "lossless," meaning no image information is lost in the compression process, and the decompressed image is identical to the original. While some information may be lost in the conversion process from RGB to indexed color format, once it is converted, the compression itself is lossless.

Common Palettes

All indexed color images (such as GIF or PNG-8) use a palette of colors to define the colors in the image. The standard available palettes along with explanations are listed here. Some, like Adaptive, are methods for producing a custom palette based on the colors in the image. Others, like Grayscale or Web216 apply a preexisting palette to the image.


Exact

If the image contains fewer than 256 colors, the Exact palette option makes a palette out of the actual colors that are found in the image.


Adaptive

This is a custom palette generated with the most commonly used pixel colors in the image. It allows for color-depth reduction while preserving the original character of the image. Because the number of colors is being reduced, some dithering and color shifting will occur.


Perceptual (Photoshop/ImageReady only)

This creates a custom palette by giving priority to colors for which the human eye has greater sensitivity. Unlike Adaptive, it is based on algorithms, not just a pixel count. It generally results in images with better color integrity than Adaptive palette images.


Selective (Photoshop/ImageReady only)

This is similar to Perceptual, but it gives preference to areas of broad color and the preservation of web-safe colors. It is the preferred palette for web graphics created with Photoshop/ImageReady.


Web Adaptive (Fireworks only)

This is an adaptive palette in which colors that are near in value to web palette colors are converted to the closest web palette color.


Restrictive (Photoshop/ImageReady) or Web216 (Fireworks)

This remaps the colors in the image to the 216 colors in the web-safe palette.


Mac OS or Windows

Choosing either system palette converts the image to the palette of 256 colors as defined by each operating system.


Uniform

This contains an evenly stepped sampling of colors from the RGB spectrum.


Custom

This allows you to load a palette that was previously saved and apply it to the current image. Otherwise, it preserves the current colors in the palette.


Optimized Median Cut (Paint Shop Pro only)

This reduces the image to a few colors using something similar to an Adaptive palette.


Optimized Octree (Paint Shop Pro only)

Use this palette if the original image has just a few colors and you want to keep those exact colors.





Web Design in a Nutshell
Web Design in a Nutshell: A Desktop Quick Reference (In a Nutshell (OReilly))
ISBN: 0596009879
EAN: 2147483647
Year: 2006
Pages: 325

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