Skip to content

Commit

Permalink
dont convert to rgba if jpeg, addresses hyde#348
Browse files Browse the repository at this point in the history
  • Loading branch information
barryrowlingson committed Oct 5, 2021
1 parent 7f41540 commit 1e9ef85
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hyde/ext/plugins/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,12 @@ def thumb(self, resource, width, height, prefix, crop_type,
self.logger.debug("Making thumbnail for [%s]" % resource)

im = self.Image.open(resource.path)
if im.mode != 'RGBA':
im = im.convert('RGBA')
format = im.format
# don't convert JPEG to RGBA because PIL doesn't
# support saving JPEGs as that from v 3.7
# see https://github.com/python-pillow/Pillow/commit/193c7561392fd12c3bd93bc232d9041c89bec4f6
if im.mode != 'RGBA' and im.format != 'JPEG':
im = im.convert('RGBA')

if preserve_orientation and im.size[1] > im.size[0]:
width, height = height, width
Expand Down

0 comments on commit 1e9ef85

Please sign in to comment.