コード例 #1
0
        private Bitmap reducedColor(Bitmap image, int numColors)
        {
            // create color image quantization routine
            ColorImageQuantizer ciq = new ColorImageQuantizer(new MedianCutQuantizer());
            // create 16 colors table
            Color[] colorTable = ciq.CalculatePalette(image, numColors);
            // create dithering routine
            FloydSteinbergColorDithering dithering = new FloydSteinbergColorDithering();
            dithering.ColorTable = colorTable;
            // apply the dithering routine
            Bitmap newImage = dithering.Apply(image);

            return newImage;
        }
コード例 #2
0
 public static Bitmap FloydSteinbergColorDithering(Bitmap bmp, int value)
 {
     // create color image quantization routine
     ColorImageQuantizer ciq = new ColorImageQuantizer(new MedianCutQuantizer());
     // create 16 colors table
     Color[] colorTable = ciq.CalculatePalette(bmp, value);
     // create dithering routine
     FloydSteinbergColorDithering dithering = new FloydSteinbergColorDithering();
     dithering.ColorTable = colorTable;
     // apply the dithering routine
     Bitmap newImage = dithering.Apply(bmp);
     return newImage;
 }
コード例 #3
0
        private static Bitmap QuantizeImage(KindleProfile profile, UnmanagedImage image)
        {
            Bitmap output;
            FloydSteinbergColorDithering dithering = new FloydSteinbergColorDithering();
            dithering.ColorTable = profile.Palette;

            output = dithering.Apply(image);

            return output;
        }