mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-04-14 02:01:01 +00:00
Merge pull request #52 from islavov/patch-1
FIX: RGBA mode breaks transparency check
This commit is contained in:
commit
7ab1d08e49
1 changed files with 3 additions and 2 deletions
|
|
@ -12,8 +12,9 @@ def img_to_fobj(img, format, **kwargs):
|
|||
|
||||
# Preserve transparency if the image is in Pallette (P) mode.
|
||||
transparency_formats = ('PNG', 'GIF', )
|
||||
if img.mode == 'P' and format in transparency_formats:
|
||||
kwargs['transparency'] = len(img.split()[-1].getcolors())
|
||||
if format in transparency_formats:
|
||||
if img.mode == 'P':
|
||||
kwargs['transparency'] = len(img.split()[-1].getcolors())
|
||||
else:
|
||||
img = img.convert('RGB')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue