From 9021ff25794e395a544b36d339fff49f163c41fb Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Wed, 5 Nov 2025 20:23:40 +0800 Subject: [PATCH] fix: inaccurate color when display CMYK images Resolve https://github.com/BLumia/pineapple-pictures/issues/100 --- app/graphicsview.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/graphicsview.cpp b/app/graphicsview.cpp index 37e5b05..2b0d82a 100644 --- a/app/graphicsview.cpp +++ b/app/graphicsview.cpp @@ -53,12 +53,15 @@ void GraphicsView::showFileFromPath(const QString &filePath) } else if (!imageReader.canRead()) { showText(tr("Image data is invalid or currently unsupported")); } else { - QPixmap && pixmap = QPixmap::fromImageReader(&imageReader); - if (pixmap.isNull()) { + QImage && img = imageReader.read(); + if (img.isNull()) { showText(tr("Image data is invalid or currently unsupported")); } else { - pixmap.setDevicePixelRatio(devicePixelRatioF()); - showImage(pixmap); + if (img.format() == QImage::Format_CMYK8888) { + img.convertToColorSpace(QColorSpace::SRgb); + } + img.setDevicePixelRatio(devicePixelRatioF()); + showImage(img); } } }