mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 01:34:24 +03:00
Merge pull request #2699 from uploadcare/better-cmyk
Convert CMYK to RGB like Google Chrome
This commit is contained in:
commit
4029998d4f
|
@ -536,12 +536,15 @@ rgb2cmyk(UINT8* out, const UINT8* in, int xsize)
|
|||
static void
|
||||
cmyk2rgb(UINT8* out, const UINT8* in, int xsize)
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < xsize; x++, in += 4) {
|
||||
*out++ = CLIP(255 - (in[0] + in[3]));
|
||||
*out++ = CLIP(255 - (in[1] + in[3]));
|
||||
*out++ = CLIP(255 - (in[2] + in[3]));
|
||||
*out++ = 255;
|
||||
int x, nk, tmp;
|
||||
for (x = 0; x < xsize; x++) {
|
||||
nk = 255 - in[3];
|
||||
out[0] = CLIP(nk - MULDIV255(in[0], nk, tmp));
|
||||
out[1] = CLIP(nk - MULDIV255(in[1], nk, tmp));
|
||||
out[2] = CLIP(nk - MULDIV255(in[2], nk, tmp));
|
||||
out[3] = 255;
|
||||
out += 4;
|
||||
in += 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user