summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-02-13 15:53:10 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-04-04 20:23:06 +0000
commitb58fc3de11f86c63347472e1640c78264ce920d9 (patch)
tree66c2768c76961977d0b280fcf271dceef319855f
parente7a4cafd8e4ab53da6ffa918448e2d97ccc711e6 (diff)
Preserve the ICC profile when saving TIFF files6.6
QColorSpace only handles RGB matrix-based ICC profiles. If one creates a QColorSpace out of an unsupported profile, QColorSpace will still store it internally, to avoid a data loss (e.g. loading and saving an image with an unsupported profile is meant to preserve that profile, even if Qt was not able to use it.) The TIFF plugin handler wasn't handling this case correctly, as it checked whether the color space was valid (it wasn't), rather than checking if it contained ICC data. Amend the check. Change-Id: I68b89d6b9c27c2b1e5a6e348b91ebf510f8dc10d Pick-to: 6.5 6.2 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 266f87720f9622ca75acacaa8e19987517df741e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit a58a5d4f45eae7bda032013b3453967ff99e9bb4)
-rw-r--r--src/plugins/imageformats/tiff/qtiffhandler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp
index aadf134..0c6936c 100644
--- a/src/plugins/imageformats/tiff/qtiffhandler.cpp
+++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp
@@ -632,8 +632,8 @@ bool QTiffHandler::write(const QImage &image)
return false;
}
// set color space
- if (image.colorSpace().isValid()) {
- QByteArray iccProfile = image.colorSpace().iccProfile();
+ const QByteArray iccProfile = image.colorSpace().iccProfile();
+ if (!iccProfile.isEmpty()) {
if (!TIFFSetField(tiff, TIFFTAG_ICCPROFILE, iccProfile.size(), reinterpret_cast<const void *>(iccProfile.constData()))) {
TIFFClose(tiff);
return false;