summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2018-07-18 09:23:23 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2018-07-18 09:23:23 +0200
commite1e82a8c93b667ac9dd35a6dd34cb30e26545798 (patch)
tree98356cacd81dfbdf1d6fb621d08157cc912d7d14
parentb1c17a50872aef6331883df221662cc361d15a7b (diff)
Fix writing thumbnails from transparent images
JPEG does not support alpha channels, so remove RGBA from the list of valid modes.
-rwxr-xr-xfbin/fbin.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/fbin/fbin.py b/fbin/fbin.py
index 7a97194..ffc6a5b 100755
--- a/fbin/fbin.py
+++ b/fbin/fbin.py
@@ -370,7 +370,7 @@ def thumb(hash):
# We can't generate a thumbnail for this file, just say it doesn't exist.
abort(404)
# Check for valid JPEG modes.
- if im.mode not in ('1', 'L', 'RGB', 'RGBA', 'RGBX', 'CMYK', 'YCbCr'):
+ if im.mode not in ('1', 'L', 'RGB', 'RGBX', 'CMYK', 'YCbCr'):
im = im.convert('RGB')
im.thumbnail(current_app.config.get('THUMB_SIZE', (128, 128)), Image.ANTIALIAS)
im.save(thumbfile)