fix: inaccurate color when display CMYK images
Resolve https://github.com/BLumia/pineapple-pictures/issues/100
This commit is contained in:
@ -53,12 +53,15 @@ void GraphicsView::showFileFromPath(const QString &filePath)
|
|||||||
} else if (!imageReader.canRead()) {
|
} else if (!imageReader.canRead()) {
|
||||||
showText(tr("Image data is invalid or currently unsupported"));
|
showText(tr("Image data is invalid or currently unsupported"));
|
||||||
} else {
|
} else {
|
||||||
QPixmap && pixmap = QPixmap::fromImageReader(&imageReader);
|
QImage && img = imageReader.read();
|
||||||
if (pixmap.isNull()) {
|
if (img.isNull()) {
|
||||||
showText(tr("Image data is invalid or currently unsupported"));
|
showText(tr("Image data is invalid or currently unsupported"));
|
||||||
} else {
|
} else {
|
||||||
pixmap.setDevicePixelRatio(devicePixelRatioF());
|
if (img.format() == QImage::Format_CMYK8888) {
|
||||||
showImage(pixmap);
|
img.convertToColorSpace(QColorSpace::SRgb);
|
||||||
|
}
|
||||||
|
img.setDevicePixelRatio(devicePixelRatioF());
|
||||||
|
showImage(img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user