This artical will help you understand the four GIF compression modes provided in PhotoController. This will be a key prerequisite to decide which mode will be used in your program. GIF compression can reduce the file size of an image, which is useful in web-based application.
Indexed Color and Palette
When you are saving GIF, you will save it to an indexed color pixelformat, eg. Format8bppIndexed. So, what is indexed color?
Indexed Color is limited to 256 colors, which can be any 256 from the set of 16.7 million 24 bit colors. Each color used is a 24 bit RGB value. Each such image file contains its own color palette, which is a list of the selected 256 colors (or 16 colors in a smaller palette). Images are called indexed color because the actual image color data for each pixel is the index into this palette. Each pixel's data is a number that specifies one of the palette colors, like maybe "color number 82", where 82 is the index into the palette, the 82nd color in the palette list of colors. We have to go to the palette to see what color is there. The palette is stored in the file with the image.
The index is typically a 4 bit value (16 colors) or 8 bit value (256 colors) for each pixel, the idea being that this is much smaller than storing 24 bits for every pixel. But an 8 bit number can only contain a numerical value of 0 to 255, so only 256 colors can be in the palette of possible colors. The size of most graphics files can be limited to use 16 colors, which only uses 4 bit indexes, making the file smaller yet, half the 8 bit size for the index for each pixel.
The file also contains the palette too, which is the table of the selected 24 bit colors, or 3 bytes of RGB overhead for each color in the palette (768 bytes for 256 colors). The first RGB color in the table is index 0, the second RGB color is index 1, etc. There can be at most only 256 colors in the palette.
So indexed files have 24 bits stored for each palette color, but not for each pixel. Each pixel only stores either a 4 bit or 8 bit index to specify which palette color is used.
Image programs will show the palette for indexed images, and can modify palette colors. There are various ways to create the palette, to choose the possible color choices that it will contain. This palette choice affects the image greatly.
What is GifAdaptive, GifStandard256, GifWebSafe, and GifOctreeQuantizer
GifAdpative is an algorithm to reduce the original palette to a smaller palette in order to obtain the compression effect.
For example the following image
It is pretty much all red, but if you are saving this image with a palette of 256 colors, which will be a bad idea. Because human being's eyes can not identify exactly those small difference on the red colors, if we use Adaptive algorithm, we could get a palette with much less color, say, may be only 14 colors. Then you gain a much smaller file.
GifWebSafe is using the standard palette (often called the Netscape palette or Web palette) always contains the same colors for any image. It is sometimes called 6-6-6, because it contains six standard evenly spaced colors for each of Red, Green, and Blue. Those 6x6x6 color combinations create 6x6x6 = 216 standard color combinations, which are independent of any specific image (used for any image). The remaining 40 colors are standard colors reserved for the Windows or Macintosh desktop. So, as its name implies, GifStandard256 is using all 256 standard color to save the image.
The Standard Palette always contains combinations of the following 6 tones for each of the Red, Green, Blue primaries:
| 6 colors, Hexadecimal (0-ff) |
|
6 colors, Decimal (0-255) |
| 00 |
33 |
66 |
99 |
CC |
FF |
|
0 |
51 |
102 |
153 |
204 |
255 |
The 216 combinations of these 18 colors above (six shades of the three RGB colors, 6x6x6 = 216) produce the Standard web-safe palette below (this one is the standard "Web" palette from Elements 2.0)

The 6x6x6 standard colors are intended to be somewhat suitable for ANY generic image, but of course, it is not correct (not precise) for any normal image.
This standard palette was very important for old 8 bit video cards. The situation used to be (in historic times, ten years ago) that 8 bit video card drivers had only one Windows video Palette Manager, requiring ALL images on that desktop to share ONE palette simultaneously. We used to see bizarre psychedelic colors when the palette of a new image reloaded that palette and affected all other images on the desktop. Perhaps palette Index 82 changed from pink to green, correct for the one image, but very wrong for all other images on the desktop. When the WWW started showing web pages with multiple images on the one web page, it was awful. Netscape standardized the 216 color palette as a workaround. ?Using one standard palette for all GIF images was better than the alternative, even if that generic palette was far from optimum for any image. This standard 216 color palette is that palette, one generic palette for all indexed images, even if not best for any image. But this concept of a Standard Palette or web-safe palette is obsolete today, now that we all have 24 bit video cards.
Today, using the Standard Netscape 216 color web-safe palette only helps those still using ancient 8 bit video cards. Using the standard 216 colors means old 8 bit video systems can show them without adding additional dithering (dotted color). This used to be important several years ago when we all had 8 bit video boards.
There are two schools of thought about this -
1) the belief that this might somehow still be important, and
2) why bother anymore? Why be artificially limited for no current reason?
My opinion is that the so-called web-safe palette is an obsolete concept, no longer useful today, and is instead outright detrimental today. There is no Windows Palette Manager anymore (except in drivers for obsolete 8 bit video boards). Today's 24 bit video boards can show any possible palette color, even when in 256 color mode (easy to test). We don't see dithered colors (speckled dotted colors) in 256 color mode anymore, unless the images were created that way in the first place by using a so-called web-safe palette. The GIF problems today are mostly all self-inflicted due to still trying to be limited to obsolete concepts (the use of non-optimum palettes). There is no magic in 216 colors on today's computers with 24 bit video.
Adaptive palettes (instead of web-safe 216 color palettes) give better images, and makes creating poor images unnecessary in indexed color. A non-dithered Adaptive palette is hard to beat.
Most of the GIF graphic images on this site (screen captured dialogs, etc) use a 16 color Adaptive palette from Nearest Color. The exact shade of color was not very important, but the small file size for the web was important (however where there was embedded photo content of many colors, the image may have been sliced, mostly GIF portions with a little JPG portion).
The few users still using ten year old 8 bit boards, if any, are frankly used to poor color, it's nothing they haven't seen before, and they can upgrade if they wish. Why make the overwhelming majority, those with the now standard 24 bit boards capable of good color, see poor color because it used to be that not everyone could? Personally, I ignore web-safe today, and I go out of my way to use the optimized or adaptive palettes for GIF files. The images are much better, without dithering dots to ruin them.
For the other side of it, Microsoft has a good write-up about Safety Palettes, about dithering and the standard 216 color web-safe browser palette. Note it is dated 1996, and it was still important then, but modern 24 bit video cards have changed the world now.
As for GifOctreeQuantizer is another algorithm to compress the GIF. It will create a tree with maximum children (colors) in the leaves, and use the tree search algorithm to find a best color to replace the origianl color in the palette.
The Usage of Different Modes
GifAdaptive
You can specify the transparent to be true of false.
When transparent is false, you can specify a transparency color.
Quality is not needed for this mode
GifOctreeQuantizer
Transparent is always false.
You can specify a transparency color, default is Color.Transparent.
Quality is needed to specify the maximum color number, and range from 1 to 255
GifStandard256
Transparent is always true.
You can't specify a transparency color, because the palette is full.
Quality is not needed for this mode.
GifWebSafe
You can specify the transparent to be true of false.
When transparent is false, you can specify a transparency color.
Quality is not needed for this mode
End.
PS: The most part of this article (especially the explanation of color palette) are copied from www.scantips.com, if I infringe any copyright, please let me know immediately. Thank you!
[Back to Top]