png_set_dither -- turn on dithering to 8-bit


#include <png.h>

void png_set_dither(png_structp png_ptr, png_colorp palette, int num_palette, int maximum_colors, png_uint_16p histogram, int full_dither);


png_set_dither() shall set transformation to dither file to 8-bit. For the given palette with num_palette number of colors, the number of colors in the palette shall be reduced to fit in "maximum_colors" if the palette is larger than maximum_colors. If supplied, the histogram is used to get better results of the reduced palette. For reducing the number of colors in palette, full_dither must be set to 0. If full_dither is set to 1, dithering cube shall be setup for RGB images to reduce the RGB file to a paletted file.