From 1166d997a3e4f7d522d66aff1459388f6ab66380 Mon Sep 17 00:00:00 2001 From: Dominique Bischof Date: Sat, 17 Jul 2021 12:15:43 -0400 Subject: [PATCH] Follow image mode when padding Forcing RBGA mode is not compatible with JPEG format. Instead follow the source image's mode. Fixes #1925 --- mezzanine/core/templatetags/mezzanine_tags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mezzanine/core/templatetags/mezzanine_tags.py b/mezzanine/core/templatetags/mezzanine_tags.py index 453eaae119..1fcb4f2df6 100644 --- a/mezzanine/core/templatetags/mezzanine_tags.py +++ b/mezzanine/core/templatetags/mezzanine_tags.py @@ -437,7 +437,7 @@ def thumbnail( pad_top = 0 pad_left = (pad_width - from_width) // 2 if pad_size is not None: - pad_container = Image.new("RGBA", pad_size, padding_color) + pad_container = Image.new(image.mode, pad_size, padding_color) pad_container.paste(image, (pad_left, pad_top)) image = pad_container