RGB/SGI writer: fix alpha detection and image limit size

(cherry picked from commit d787c12727)
This commit is contained in:
Mirco Miranda
2023-05-07 10:46:23 +02:00
committed by Albert Astals Cid
parent c9aa1ff629
commit f7fd14d418
2 changed files with 8 additions and 11 deletions

View File

@ -430,10 +430,11 @@ bool TGAHandler::write(const QImage &image)
QImage img(image);
const bool hasAlpha = img.hasAlphaChannel();
if (hasAlpha && img.format() != QImage::Format_ARGB32)
if (hasAlpha && img.format() != QImage::Format_ARGB32) {
img = img.convertToFormat(QImage::Format_ARGB32);
else if (!hasAlpha && img.format() != QImage::Format_RGB32)
} else if (!hasAlpha && img.format() != QImage::Format_RGB32) {
img = img.convertToFormat(QImage::Format_RGB32);
}
if (img.isNull()) {
qDebug() << "TGAHandler::write: image conversion to 32 bits failed!";
return false;