Skip to content

Commit

Permalink
Fixing scenario where a JPG/GIF thumbnail is created with padding, re…
Browse files Browse the repository at this point in the history
…sulting thumbnail needs to be saved as a PNG. For stephenmcd#1925
  • Loading branch information
molokov committed Jul 2, 2019
1 parent cf6c79c commit 9b43cc4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mezzanine/core/templatetags/mezzanine_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,11 @@ def thumbnail(image_url, width, height, upscale=True, quality=95, left=.5,
pad_container = Image.new("RGBA", pad_size, padding_color)
pad_container.paste(image, (pad_left, pad_top))
image = pad_container
# Make thumbnail a PNG - required if original isn't one
if filetype != "PNG":
filetype = "PNG"
thumb_path += ".png"
thumb_url += ".png"

# Create the thumbnail.
to_size = (to_width, to_height)
Expand Down

0 comments on commit 9b43cc4

Please sign in to comment.