mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Make libimagequant visibility detectable
This commit is contained in:
parent
0b4a089321
commit
8b7fb44c6b
|
@ -1577,6 +1577,7 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans)
|
|||
);
|
||||
break;
|
||||
case 3:
|
||||
#ifdef HAVE_LIBIMAGEQUANT
|
||||
if (!strcmp(im->mode, "RGBA")) {
|
||||
withAlpha = 1;
|
||||
}
|
||||
|
@ -1590,6 +1591,9 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans)
|
|||
&newData,
|
||||
withAlpha
|
||||
);
|
||||
#else
|
||||
result = -1;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
result = 0;
|
||||
|
@ -1599,7 +1603,7 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans)
|
|||
free(p);
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
if (result) {
|
||||
if (result > 0) {
|
||||
imOut = ImagingNew("P", im->xsize, im->ysize);
|
||||
ImagingSectionEnter(&cookie);
|
||||
|
||||
|
@ -1639,6 +1643,12 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans)
|
|||
|
||||
} else {
|
||||
|
||||
if (result == -1) {
|
||||
return (Imaging) ImagingError_ValueError(
|
||||
"dependency required by this method was not "
|
||||
"enabled at compile time");
|
||||
}
|
||||
|
||||
return (Imaging) ImagingError_ValueError("quantization error");
|
||||
|
||||
}
|
||||
|
|
|
@ -122,21 +122,4 @@ err:
|
|||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Offer dummy implementation */
|
||||
int
|
||||
quantize_pngquant(
|
||||
Pixel *pixelData,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
uint32_t quantPixels,
|
||||
Pixel **palette,
|
||||
uint32_t *paletteLength,
|
||||
uint32_t **quantizedPixels,
|
||||
int withAlpha)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user