From 34d35a23930815438a4e1d8b28ec17016fb938c0 Mon Sep 17 00:00:00 2001 From: cfdv Date: Sun, 12 Jun 2011 17:35:07 -0500 Subject: [PATCH] ensure color mode compatibility when making image thumbnails --- mediagoblin/process_media/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mediagoblin/process_media/__init__.py b/mediagoblin/process_media/__init__.py index c71c5dda..f0a6e511 100644 --- a/mediagoblin/process_media/__init__.py +++ b/mediagoblin/process_media/__init__.py @@ -41,6 +41,9 @@ def process_media_initial(media_id): with queued_file: thumb = Image.open(queued_file) thumb.thumbnail(THUMB_SIZE, Image.ANTIALIAS) + # ensure color mode is compatible with jpg + if thumb.mode != "RGB": + thumb = thumb.convert("RGB") thumb_filepath = mgg.public_store.get_unique_filepath( ['media_entries', -- 2.25.1