mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +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;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
#ifdef HAVE_LIBIMAGEQUANT
|
||||||
if (!strcmp(im->mode, "RGBA")) {
|
if (!strcmp(im->mode, "RGBA")) {
|
||||||
withAlpha = 1;
|
withAlpha = 1;
|
||||||
}
|
}
|
||||||
|
@ -1590,6 +1591,9 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans)
|
||||||
&newData,
|
&newData,
|
||||||
withAlpha
|
withAlpha
|
||||||
);
|
);
|
||||||
|
#else
|
||||||
|
result = -1;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = 0;
|
result = 0;
|
||||||
|
@ -1599,7 +1603,7 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans)
|
||||||
free(p);
|
free(p);
|
||||||
ImagingSectionLeave(&cookie);
|
ImagingSectionLeave(&cookie);
|
||||||
|
|
||||||
if (result) {
|
if (result > 0) {
|
||||||
imOut = ImagingNew("P", im->xsize, im->ysize);
|
imOut = ImagingNew("P", im->xsize, im->ysize);
|
||||||
ImagingSectionEnter(&cookie);
|
ImagingSectionEnter(&cookie);
|
||||||
|
|
||||||
|
@ -1639,6 +1643,12 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans)
|
||||||
|
|
||||||
} else {
|
} 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");
|
return (Imaging) ImagingError_ValueError("quantization error");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,21 +122,4 @@ err:
|
||||||
return result;
|
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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user