diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-02-13 15:53:10 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-04-04 15:30:50 +0200 |
commit | 266f87720f9622ca75acacaa8e19987517df741e (patch) | |
tree | 6e2c93de5cfc34401a66217d2d7f7207d0d2967a | |
parent | 3382c2871d7339ba1e98f21333bf5e656560822c (diff) |
Preserve the ICC profile when saving TIFF files
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.7 6.5 6.2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | src/plugins/imageformats/tiff/qtiffhandler.cpp | 4 |
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; |