cgifsave: limit max number of colours to 255 (#2863)
* cgifsave: limit max number of colours to 255 * switch to VIPS_MIN
This commit is contained in:
parent
41da0d28e0
commit
905a6fe79f
|
@ -738,7 +738,11 @@ vips_foreign_save_cgif_build( VipsObject *object )
|
||||||
/* Set up libimagequant.
|
/* Set up libimagequant.
|
||||||
*/
|
*/
|
||||||
cgif->attr = vips__quantise_attr_create();
|
cgif->attr = vips__quantise_attr_create();
|
||||||
vips__quantise_set_max_colors( cgif->attr, 1 << cgif->bitdepth );
|
/* Limit the number of colours to 255, so there is always one index
|
||||||
|
* free for the transparency optimization.
|
||||||
|
*/
|
||||||
|
vips__quantise_set_max_colors( cgif->attr,
|
||||||
|
VIPS_MIN( 255, 1 << cgif->bitdepth ) );
|
||||||
vips__quantise_set_quality( cgif->attr, 0, 100 );
|
vips__quantise_set_quality( cgif->attr, 0, 100 );
|
||||||
vips__quantise_set_speed( cgif->attr, 11 - cgif->effort );
|
vips__quantise_set_speed( cgif->attr, 11 - cgif->effort );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue