Color resolution (also called color depth) refers to the number of possible colors in an image, as determined by the bits-per-pixel. If an image in your computer is loaded from a FAX scanner or received as a FAX transmission, it is a black-and-white (1-bit) image. If it is loaded from a color scanner or a JPEG file, it can have 16 million colors. If it is loaded from a GIF file, it is likely to have 256 colors. There are many possibilities, ranging from two colors to 16 million.
LEADTOOLS lets you manipulate an image and display it on any Windows-compatible device, regardless of the image's color resolution. Therefore, in most cases you can load, display, modify, and save an image without ever changing its color resolution. Nevertheless, in some cases you may need to increase or decrease the color resolution. Here are some examples:
Suppose you need to load a large 24-bit image on a computer that does not have much memory. You can conserve memory by loading it as an 8-bit image. Then, if you were using an 8-bit display device, you would not see any difference in the quality of the image. Of course, there would be some loss of quality on a 24-bit display device, and the loss would be permanent if you then saved the image in the same file.
Suppose you want to save an image in a different file format. If the new file format does not support the original color resolution, you can specify a different color resolution when you save the image.
Suppose you want to combine one 8-bit image with another one. To combine two images, they must have the same color resolution, and if they are less than 16 bits per pixel, they must use the same palette. The simplest solution is to convert both images to 24 bits per pixel before combining them. Then, if necessary, you can reduce the color resolution of the combined image.
Whenever you reduce an image's color resolution to 8 bits per pixel or less, a dithering method comes into play. One alternative is to use a nearest-color match (no dithering), which means that the color of each pixel is changed to the palette color that most closely matches it. If the original image contains subtle color details, the result of a nearest-color match may have large blotches of color that are not very pleasing.
Dithering methods create the appearance of more subtle shades by mixing in pixels of different colors. This is similar to the way newspaper pictures produce the appearance of shades of gray, even though the only actual colors are black and white.
Ordered dithering and cluster dithering are the fastest methods. They are effective for reducing the number of colors to 256 colors or less. Ordered dithering is the default dithering method when painting to a display device that is 256 colors or less.
These methods take advantage of the fact that the colors in most palettes are ordered so that similar shades are next to each other in the palette. Pixels used in dithering are taken from these adjacent colors to achieve the nearest shade. They place pixels from shades near to the original color to achieve a smoothing effect. Ordered dithering avoids blotches of color by adding to or subtracting from the nearest-color value of each pixel to ensure that adjacent pixels do not have exactly the same color. However, If the colors in the palette are not ordered, the results may be poor.
All of the other dithering methods in LEADTOOLS use error-diffusion algorithms. In error diffusion, the error is the difference between the original pixel color and the nearest match, and the algorithm spreads pixel placement (performs diffusion) around this error. Error-diffusion dithering produces better quality images than other methods for photographic images, images that are not going to be compressed with CCITT or run-length encoding, and images with continuous tones (gradients).If you use a LEADTOOLS function to change the color resolution of a bitmap in memory, you can choose from a list of possible error diffusion dithering methods.
Floyd-Steinberg is a high-quality, fast error-diffusion method. It is the default method that LEADTOOLS uses if you reduce the color resolution when loading or saving an image, or if you specify error diffusion as the dithering method when painting to a display device that is 256 colors or less.
All of the alternative error-diffusion methods are slower than Floyd-Steinberg, and the quality may or may not be better, depending on the original image, and depending on whether the resulting image is to be displayed or printed. Stevenson Arce dithering, the slowest of the alternatives, is most likely to produce a higher quality result.
All error-diffusion methods produce similar results, and booth ordered and error-diffusion dither algorithms have advantages and disadvantages:
Color Map. The advantage of error-diffusion dither over ordered dither is that it can choose colors from any color map, while the ordered dither algorithm can only dither to colors from a special "uniform" palette.
Localization. Ordered dither has the advantage that the dithering of one pixel does not influence the dithering of surrounding pixels; that is, the dither is "localized". This is especially useful when the dithered image is used in an animation sequence.
Patterning. However, ordered dither shows strong patterns, which degrade the subjective quality of a dithered picture. On the other hand, error-diffusion dithers suffer from a "directional emphasis". These are not as disturbing as the ordered patterns, but are quite visible nonetheless.
Frequency. The error-diffusion dither algorithms score quite well on the criterion to dither primarily in the "high frequencies", which makes the dithered pictures more detailed and more attractive. Ordered dither is coarser than error-diffusion, due to the presence of low frequencies.
In order to achieve the desired results for an image, it is usually best to apply each dithering method to the original, and see which yields the most desirable result.
To see sample results from applying various dithering methods to an image, refer to Color Resolution and Dithering.
A family of wide-primary output-referred extended color-gamut BGR color encoding called Reference Output Medium Metric (ROMM) BGR Color encodings are used by digital still picture imaging systems to manipulate, store, transmit, display and print digital images. Unlike sRGB color encoding, the range of colors is not limited to those colors that can be displayed on a CRT monitor, and unlike e-sRGB, these encodings do not use negative RGB colorimetry co-ordinates.
ROMM color order can be used only with 24 or 48-bit bitmaps and is supported by the CMP/JPEG/Exif JPEG/JTIF/TIFF CMP file formats. There are colors that can be represented in RGB, but not in ROMM. Conversely, there are colors that can be represented in ROMM that cannot be represented in RGB. If you convert from one to the other you lose the colors that can be represented only in one of the colorspaces.
LAnimationWindow::ColorResItems, LBitmapBase::ColorRes, LBitmapBase::DitherLine, LBitmapBase::GetDefaultDithering, LBitmapBase::GetDitheringMethod LBitmapBase::StartDithering, LBitmapBase::StopDithering, LBitmapSettings::DefaultDithering