From 325d67578667df0a95b17b86661c74c2a1dca8a8 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 28 Mar 2019 10:44:06 -0300 Subject: [PATCH] Fix thumbnails for indexed images with transparent color (GIF files mainly) --- src/app/thumbnail_generator.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/thumbnail_generator.cpp b/src/app/thumbnail_generator.cpp index 50217e2cb..6118fb35d 100644 --- a/src/app/thumbnail_generator.cpp +++ b/src/app/thumbnail_generator.cpp @@ -105,6 +105,15 @@ private: // The palette to convert the Image palette.reset(new Palette(*sprite->palette(frame_t(0)))); + // Special case for indexed images: + // If the sprite is transparent -> set the transparent color index alpha = 0 + if (sprite->colorMode() == ColorMode::INDEXED && + !sprite->backgroundLayer()) { + int i = sprite->transparentColor(); + if (i >= 0 && i < int(palette->size())) + palette->setEntry(i, doc::rgba(0, 0, 0, 0)); + } + const int w = sprite->width()*sprite->pixelRatio().w; const int h = sprite->height()*sprite->pixelRatio().h;