From b594de0ae46acf032af06947e4273eaf8905001a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 9 May 2016 17:00:34 +0530 Subject: [PATCH] Handle Format_Grayscale8 images --- src/calibre/utils/imageops/quantize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/imageops/quantize.cpp b/src/calibre/utils/imageops/quantize.cpp index 5643fc50ee..6787fc9fee 100644 --- a/src/calibre/utils/imageops/quantize.cpp +++ b/src/calibre/utils/imageops/quantize.cpp @@ -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_pool((MAX_LEAVES + 1) * 8); if (palette.size() > 0) {