Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CMYK to RGB unpacker #7310

Merged
merged 3 commits into from
Oct 6, 2023
Merged

Added CMYK to RGB unpacker #7310

merged 3 commits into from
Oct 6, 2023

Conversation

radarhere
Copy link
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
Copy link
Member

hugovk commented Oct 5, 2023

essentially copying the code from ...

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

@radarhere
Copy link
Member Author

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

@hugovk hugovk merged commit 5957f10 into python-pillow:main Oct 6, 2023
52 checks passed
@radarhere radarhere deleted the cmyk2rgb branch October 6, 2023 07:45
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