Skip to content

Commit af931c7

Browse files
Add warning for tiles image format conversion
1 parent 9c1435b commit af931c7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/core/tileset.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,11 @@ bool Tileset::loadTilesImage(QImage *importedImage) {
563563
imported = true;
564564
} else if (QFile::exists(this->tilesImagePath)) {
565565
// No image provided, load from file path.
566-
image = QImage(this->tilesImagePath).convertToFormat(QImage::Format_Indexed8, Qt::ThresholdDither);
566+
image = QImage(this->tilesImagePath);
567+
if (!image.isNull() && image.format() != QImage::Format_Indexed8) {
568+
logWarn(QString("Tiles image '%1' is not indexed. Converting to indexed format.").arg(this->tilesImagePath));
569+
image.convertTo(QImage::Format_Indexed8, Qt::ThresholdDither);
570+
}
567571
}
568572

569573
if (image.isNull()) {

0 commit comments

Comments
 (0)