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.5 6.2 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit266f87720f
) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commita58a5d4f45
)
This commit is contained in:
parent
e7a4cafd8e
commit
b58fc3de11
|
@ -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