Sometimes described above palette cost reduction without any loss of quality, so the original image is already contained less than 256 colors. But far more often in reducing the number of colors the program must approximate the original image color palette truncated. This can be done one of two ways.
The first way is that each color of the original image is translated simply closest to it a new color palette (and since it is smaller than the original, some of the color was different in the original, after the conversion will merge into one color). Typically, this leads to the fact that the smooth color transitions are staggered, and the general color of the image changes quite dramatically.
therefore often use a different method of approximation - diffusion (diffusion, or dithering). The regions that were covered in the original solid color, after the conversion of pixels filled with a mixture of different colors scattered randomly. As a rule, each missing in the reduced color palette, pixel passed two closest to him a new palette of colors. As a result, the image acquires a grainy, rough texture.
Which of these methods and when to choose? Here again we have to remember the division IMAGES to "artificial" and "natural", which we have mentioned above. "Artificial" images with areas of flat color and sharp boundaries are not usually very loose to the direct replacement of colors without diffusion. Of course, the total range of the image with the change, but in many cases, do not worry about it. Diffusion is contraindicated for such IMAGES as giving them a rather unkempt appearance. On the contrary, the "natural" image of the introduction of diffusion is usually little affected, while an attempt to reduce their palette without diffusion often leads to a completely unacceptable results.