Skip to Main Content
Painting the Web
book

Painting the Web

by Shelley Powers
May 2008
Beginner content levelBeginner
656 pages
17h 41m
English
O'Reilly Media, Inc.
Content preview from Painting the Web

GIF: Lossless and Paletted

CompuServe created the GIF format in the 1980s to provide a way of exchanging images at this early Internet service. The original version was 87a (GIF87a), and an improved version is 89a (GIF89a). If JPEG is optimized for continuous color images, GIF is optimized for what is known as "flat color" graphics, graphics that have sharp rather than continuous edges between changing colors.

GIF is an uncomplicated 8-bit format, supporting 256 colors. Additionally, to further save storage space, GIFs are based on an optimized palette, which maps each color in the palette to a specific RGB value.

Tip

There actually is a way to support 24-bit truecolor GIFs, but such a practice is purely a hack, and with truecolor supported in JPEG and PNG, unnecessary for web graphics.

The 256 colors supported with GIFs is an optimal number of colors for using a color management technique known as palettes. With palettes, rather than each pixel having its own embedded RGB color, which takes 24 bits, it contains an 8-bit lookup value that is then used with a color lookup table to find the actual color. A version of PNG—8-bit PNG—also supports a palette.

The GIF format utilizes a lossless compression technique known as LZW lossless data compression. This type of compression works by finding a sequence of characters that form a pattern and then entering such in a table, where it's mapped to a given, shorter length code. Then, whenever the pattern repeats, the shorter code is used. As such, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Reinventing the Organization for GenAI and LLMs

Reinventing the Organization for GenAI and LLMs

Ethan Mollick
Mastering PHP 7

Mastering PHP 7

Branko Ajzele

Publisher Resources

ISBN: 9780596515096Supplemental ContentErrata Page