Skip to content

Commit

Permalink
fix: format thumbnail from original #11
Browse files Browse the repository at this point in the history
  • Loading branch information
silentsokolov committed Sep 1, 2017
1 parent 4f7f07a commit 92c465c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion flask_thumbnails/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def get_thumbnail(self, original, size, **options):
self.app.logger.warning('Thumbnail not load image: %s', original_filepath)
return thumbnail_url

# get original image format
options['format'] = options.get('format', image.format)

image = self._create_thumbnail(image, thumbnail_size, crop)

raw_data = self.get_raw_data(image, **options)
Expand All @@ -133,7 +136,7 @@ def get_raw_data(self, image, **options):

@staticmethod
def colormode(image, colormode='RGB'):
if colormode == 'RGB':
if colormode == 'RGB' or colormode == 'RGBA':
if image.mode == 'RGBA':
return image
if image.mode == 'LA':
Expand Down

0 comments on commit 92c465c

Please sign in to comment.