mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 02:06:18 +03:00
use RGBX raw mode for RGB JPEG images
This commit is contained in:
parent
bf1f4b04f7
commit
a926d2e16f
9
decode.c
9
decode.c
|
@ -752,6 +752,15 @@ PyImaging_TgaRleDecoderNew(PyObject* self, PyObject* args)
|
|||
if (decoder == NULL)
|
||||
return NULL;
|
||||
|
||||
#if defined(JCS_EXTENSIONS)
|
||||
// libjpeg-turbo supports different output formats.
|
||||
// We are choosing Pillow's native format (3 color bytes + 1 padding)
|
||||
// to avoid extra conversion in Unpack.c.
|
||||
if (strcmp(rawmode, "RGB") == 0) {
|
||||
rawmode = "RGBX";
|
||||
}
|
||||
#endif
|
||||
|
||||
if (get_unpacker(decoder, mode, rawmode) < 0)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -189,6 +189,10 @@ ImagingJpegDecode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
|||
context->cinfo.out_color_space = JCS_GRAYSCALE;
|
||||
else if (strcmp(context->rawmode, "RGB") == 0)
|
||||
context->cinfo.out_color_space = JCS_RGB;
|
||||
#if defined(JCS_EXTENSIONS)
|
||||
else if (strcmp(context->rawmode, "RGBX") == 0)
|
||||
context->cinfo.out_color_space = JCS_EXT_RGBX;
|
||||
#endif
|
||||
else if (strcmp(context->rawmode, "CMYK") == 0 ||
|
||||
strcmp(context->rawmode, "CMYK;I") == 0)
|
||||
context->cinfo.out_color_space = JCS_CMYK;
|
||||
|
|
Loading…
Reference in New Issue
Block a user