Skip to content

Commit

Permalink
Fix embedding cover for PNG with alpha channel
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma committed May 5, 2018
1 parent c6a979b commit 51fae55
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions amg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ def get_cover_data(review):
if cover_ext == "png":
# convert to JPEG
img = PIL.Image.open(filepath)
if img.mode != "RGB":
img = img.convert("RGB")
f = io.BytesIO()
img.save(f, format="JPEG", quality=90, optimize=True)
f.seek(0)
Expand Down

0 comments on commit 51fae55

Please sign in to comment.