Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.
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
Fix ISSUE #706 The color of CMYK pixel format pictures is incorrect.
swap the positions of b and r
  • Loading branch information
e8-ShiWei committed May 31, 2021
commit d4adbb37a5ecf451cfd02f8cbda2f9622f558f3f
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