mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Merge branch 'fix-webp' of https://github.com/homm/Pillow into webp_lossless_abi
This commit is contained in:
commit
ee3b346418
10
_webp.c
10
_webp.c
|
@ -34,18 +34,24 @@ PyObject* WebPEncode_wrapper(PyObject* self, PyObject* args)
|
||||||
if (size < width * height * 4){
|
if (size < width * height * 4){
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
#if WEBP_ENCODER_ABI_VERSION >= 0x0100
|
||||||
if (lossless) {
|
if (lossless) {
|
||||||
ret_size = WebPEncodeLosslessRGBA(rgb, width, height, 4* width, &output);
|
ret_size = WebPEncodeLosslessRGBA(rgb, width, height, 4* width, &output);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
ret_size = WebPEncodeRGBA(rgb, width, height, 4* width, quality_factor, &output);
|
ret_size = WebPEncodeRGBA(rgb, width, height, 4* width, quality_factor, &output);
|
||||||
}
|
}
|
||||||
} else if (strcmp(mode, "RGB")==0){
|
} else if (strcmp(mode, "RGB")==0){
|
||||||
if (size < width * height * 3){
|
if (size < width * height * 3){
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
#if WEBP_ENCODER_ABI_VERSION >= 0x0100
|
||||||
if (lossless) {
|
if (lossless) {
|
||||||
ret_size = WebPEncodeLosslessRGB(rgb, width, height, 3* width, &output);
|
ret_size = WebPEncodeLosslessRGB(rgb, width, height, 3* width, &output);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
ret_size = WebPEncodeRGB(rgb, width, height, 3* width, quality_factor, &output);
|
ret_size = WebPEncodeRGB(rgb, width, height, 3* width, quality_factor, &output);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user