From d4adbb37a5ecf451cfd02f8cbda2f9622f558f3f Mon Sep 17 00:00:00 2001 From: Shi Wei Date: Tue, 1 Jun 2021 07:25:58 +0800 Subject: [PATCH] Fix ISSUE #706 The color of CMYK pixel format pictures is incorrect. swap the positions of b and r --- src/jpegcodec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/jpegcodec.c b/src/jpegcodec.c index 66af1a3da..11e1a8ae9 100644 --- a/src/jpegcodec.c +++ b/src/jpegcodec.c @@ -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);