Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Fix ISSUE #706 The color of CMYK pixel format pictures is incorrect. #707

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/jpegcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,13 @@ gdip_load_jpeg_image_internal (struct jpeg_source_mgr *src, GpImage **image)
/* Adobe photoshop seems to have a bug and inverts the CMYK data.
* We might need to remove this check, if Adobe decides to fix it. */
if (cinfo.saw_Adobe_marker) {
b = (k * c) / 255;
r = (k * c) / 255;
g = (k * m) / 255;
r = (k * y) / 255;
b = (k * y) / 255;
} else {
b = (255 - k) * (255 - c) / 255;
r = (255 - k) * (255 - c) / 255;
g = (255 - k) * (255 - m) / 255;
r = (255 - k) * (255 - y) / 255;
b = (255 - k) * (255 - y) / 255;
}

set_pixel_bgra(lineptr, 0, b, g, r, 0xff);
Expand Down