

Pixels used in dithering are taken from these adjacent colors to achieve the nearest shade. 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. Ordered dithering is the default dithering method when painting to a display device that is 256 colors or less. They are effective for reducing the number of colors to 256 colors or less. Ordered dithering and cluster dithering are the fastest methods. Private Shared Sub Test( ByVal codecs As RasterCodecs, ByVal coloredImageFileName As String) ' is false by default Dim image As RasterImage = codecs.Load(coloredImageFileName) ' Save it with no dithering options codecs.Save(image, "C:\NotDithered.tif", RasterImageFormat.CcittGroup4, 1) ' Change the image dithering method to FloydStein image.DitheringMethod = RasterDitheringMethod.FloydStein ' Use the image dithering method when saving = True ' Save it again codecs.Save(image, "C:\Dithered.tif", RasterImageFormat.CcittGroup4, 1) image.Dispose() End Sub The following example will load a 24-bits per pixel image and save it as bitonal with and without dithering. To enable dithering, set the dithering method inside the RasterImage to the required value and then instruct RasterCodecs to use this value when saving the image. This is similar to the way newspaper pictures produce the appearance of shades of gray, even though the only actual colors are only black and white. 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.ĭithering methods create the appearance of more subtle shades by mixing in pixels of different colors.

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. Whenever an image's color depth is reduced to 8-bits per pixel or less, a dithering method may come into play. Then, if necessary, you can reduce the color resolution of the combined image. The simplest solution is to convert both images to 24-bits per pixel before combining them. 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. Suppose you want to combine one 8-bit image with another one. 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 save an image in a different file format. 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. Then, if you were using an 8-bit display device, you would not see any difference in the quality of the image. You can conserve memory by loading it as an 8-bit image. Suppose you need to load a large 24-bit image on a computer that does not have much memory.

Nevertheless, in some cases you may need to increase or decrease the color resolution. Therefore, in most cases you can load, display, modify and save an image without ever changing its color resolution. LEADTOOLS lets you manipulate an image and display it on any Windows-compatible device, regardless of the image's color resolution. There are many possibilities, ranging from two colors to 16 million. If it is loaded from a GIF file, it is likely to have 256 colors. If it is loaded from a color scanner or a JPEG file, it can have 16 million colors.

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. Color resolution (also called color depth) refers to the number of possible colors in an image, as determined by the bits-per-pixel.
