Controls on the Quality of 8 Bit-Plane Bitmap Files
Controls on the quality of 8 bit-plane bitmap files
24 bit BMP files tend to be huge, and the space saved by using a compressed format is attractive. In most cases, JPEG or PNG should be the compressed format of choice.
If an 8 bit format must be used (e.g. when producing an animated GIF ), there is no avoiding some loss of quality. This is because truncation of a 24 bit format (16 million colours) to 8 bits (256 colours) gives rise to "banding", in which the least significant bits of the original colour definitions are lost. The following options can be used to help alleviate this issue.
Dither image
The following sequence of images show how the different levels of dithering
affect the quality and file size of a compressed 8 bit image, comparing
it with the JPEG equivalent.For static images there is no advantage in using BMP files over JPEGs or PNGs: BMP files are larger and of inferior quality.
For animated files, we recommend using the MP4 option to produce high-quality output in a widely-supported format. However if you have to revert to an 8 bit AVI format, or if you want to produce an animated GIF, the various permutations of options below will be of interest when trying to obtain the best compromise between image quality and overall file size.
|
|
Consider the bits for a single colour in this image that have been truncated from 24 bits (8 bits each of Red, Green and Blue). Truncated bits are shown in lower case.
The result may be truncated to 001ooooo , or the increased to the next shade up 010ooooo , depending on the trailing bits ????? and the noise value xxxxx at that pixel. The effect is to produce a composite shade that is somewhere between the two originals. Here is a dithered version of the image above, size 8kB . ![]() Some banding is still visible, but it has been reduced to an acceptable level, and the coarsening of spatial resolution is also evident. Generally dithering gives the best results for animated 8 bit images |
||||||||||
|
Palette Optimization When 8 bit images are produced the 24 bit palette has to be reduced to only 256 colours. To do this the best way is to use Palette Optimization to choose the most representative colours used in the image. Without Palette Optimization 256 colours can be chosen uniformly along the original 24 bit palette, missing out important colours. The following figures show the differences in images with Palette Optimization. |
|
|
|
| This is the original image, saved as a GIF, with no dithering or palette optimization. Size 6.1kB |
This is the image, saved as a GIF, with palette optimization. Size 12.6kB Note that whilst there are still bands, the coarseness of them has diminished. |
|
The two images above were created from a shaded image plot in D3PLOT and therefore contained a lot of different colours. The banding is present because the palette has been reduced to the 256 most representative colours in the image. The following figures are images of a contour plot in D3PLOT. |
|
|
|
|
This is the image, saved as a GIF, with palette optimization. Size 3.1kB Note that due to the smaller number of colours in the image, there is no banding. |
This is the image, saved as a GIF, with dithering. Size 3.7kB Dithering is not well suited to images with distinct colours since by its nature it produces colours that are somewhere in between neighbouring colours. This is effective with shaded images, but not with images where there are sharp changes of colour. |
