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>
This commit is contained in:
parent
3382c2871d
commit
266f87720f
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue