Functions for truecolor to palette conversion
Color Quantization | Functions for truecolor to palette conversion |
Functions | |
gdImageTrueColorToPaletteSetMethod | Selects the quantization method |
gdImageTrueColorToPaletteSetQuality | Chooses a quality range for quantization |
gdImageCreatePaletteFromTrueColor | Creates a new palette image from a truecolor image |
gdImageTrueColorToPalette | Converts a truecolor image to a palette image |
int gdImageTrueColorToPaletteSetMethod ( gdImagePtr im, int method, int speed )
Selects the quantization method
That quantization method is used for all subsequent gdImageTrueColorToPalette and gdImageCreatePaletteFromTrueColor calls.
im | The image. |
method | The quantization method, see gdPaletteQuantizationMethod. |
speed | The quantization speed between 1 (highest quality) and 10 (fastest). 0 selects a method-specific default (recommended). |
Zero if the given method is invalid or not available; non-zero otherwise.
void gdImageTrueColorToPaletteSetQuality ( gdImagePtr im, int min_quality, int max_quality )
Chooses a quality range for quantization
That quality range is used in all subsequent calls to gdImageTrueColorToPalette and gdImageCreatePaletteFromTrueColor if the quantization method is GD_QUANT_LIQ.
im | The image. |
min_quality | The minimum quality in range 1-100 (1 = ugly, 100 = perfect). If the palette cannot represent the image with at least min_quality, then no conversion is done. |
max_quality | The maximum quality in range 1-100 (1 = ugly, 100 = perfect), which must be higher than the min_quality. If the palette can represent the image with a quality better than max_quality, then fewer colors than requested will be used. |
gdImagePtr gdImageCreatePaletteFromTrueColor ( gdImagePtr im, int dither, int colorsWanted )
Creates a new palette image from a truecolor image
im | The image. |
dither | Whether dithering should be applied. |
colorsWanted | The number of desired palette entries. |
A newly create palette image; NULL on failure.
int gdImageTrueColorToPalette ( gdImagePtr im, int dither, int colorsWanted )
Converts a truecolor image to a palette image
im | The image. |
dither | Whether dithering should be applied. |
colorsWanted | The number of desired palette entries. |
Non-zero if the conversion succeeded, zero otherwise.
Selects the quantization method
int gdImageTrueColorToPaletteSetMethod ( gdImagePtr im, int method, int speed )
Chooses a quality range for quantization
void gdImageTrueColorToPaletteSetQuality ( gdImagePtr im, int min_quality, int max_quality )
Creates a new palette image from a truecolor image
gdImagePtr gdImageCreatePaletteFromTrueColor ( gdImagePtr im, int dither, int colorsWanted )
Converts a truecolor image to a palette image
int gdImageTrueColorToPalette ( gdImagePtr im, int dither, int colorsWanted )
Creates a new palette image from a truecolor image
gdImagePtr gdImageNeuQuant( gdImagePtr im, const int max_color, int sample_factor )
Convert a palette image to true color
int gdImagePaletteToTrueColor( gdImagePtr src )