Apply() public method

Perform color dithering for the specified image.
Unsupported pixel format of the source image. It must 24 or 32 bpp color image.
public Apply ( Bitmap sourceImage ) : Bitmap
sourceImage System.Drawing.Bitmap Source image to do color dithering for.
return System.Drawing.Bitmap
Ejemplo n.º 1
0
 public static Bitmap OrderedColorDithering(Bitmap bmp, int value)
 {
     // create color image quantization routine
     ColorImageQuantizer ciq = new ColorImageQuantizer(new MedianCutQuantizer());
     // create 256 colors table
     Color[] colorTable = ciq.CalculatePalette(bmp, value);
     // create dithering routine
     OrderedColorDithering dithering = new OrderedColorDithering();
     dithering.ColorTable = colorTable;
     // apply the dithering routine
     Bitmap newImage = dithering.Apply(bmp);
     return newImage;
 }