Handle Format_Grayscale8 images

This commit is contained in:
Kovid Goyal 2016-05-09 17:00:34 +05:30
parent 9debdee433
commit b594de0ae4

View File

@ -419,7 +419,7 @@ QImage quantize(const QImage &image, unsigned int maximum_colors, bool dither, c
if (fmt != QImage::Format_RGB32 && fmt != QImage::Format_Indexed8 && fmt != 24) { // 24 = QImage::Format_Grayscale8
img = img.convertToFormat(QImage::Format_RGB32);
if (img.isNull()) throw std::bad_alloc();
}
} else if (fmt == 24) img = img.convertToFormat(QImage::Format_Indexed8);
// There can be no more than MAX_LEAVES * 8 nodes. Add 1 in case there is an off by 1 error somewhere.
Pool<Node> node_pool((MAX_LEAVES + 1) * 8);
if (palette.size() > 0) {