Skip to content

Added CMYK to RGB unpacker - #7310

Merged
hugovk merged 3 commits into
python-pillow:mainfrom
radarhere:cmyk2rgb
Oct 6, 2023
Merged

hugovk merged 3 commits into
python-pillow:mainfrom
radarhere:cmyk2rgb

Conversation

@radarhere

Copy link
Copy Markdown
Member

Resolves #7309

Adds a CMYK to RGB unpacker, essentially copying the code from

static void
cmyk2rgb(UINT8 *out, const UINT8 *in, int xsize) {
int x, nk, tmp;
for (x = 0; x < xsize; x++) {
nk = 255 - in[3];
out[0] = CLIP8(nk - MULDIV255(in[0], nk, tmp));
out[1] = CLIP8(nk - MULDIV255(in[1], nk, tmp));
out[2] = CLIP8(nk - MULDIV255(in[2], nk, tmp));
out[3] = 255;
out += 4;
in += 4;
}
}

@hugovk

hugovk commented Oct 5, 2023

Copy link
Copy Markdown
Member

essentially copying the code from ...

Is it worth de-duplicating, and having them both calling a common function?

@radarhere

Copy link
Copy Markdown
Member Author

Ok, I've pushed a commit to include the Convert function in Unpack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add capability to process CMYK palettes

3 participants