Applying quote fails with Pillow>=4.2.0

Bug #1703057 reported by Elon Bing
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Variety
Fix Released
High
James Lu

Bug Description

Starting with Pillow 4.2.0, Variety fails when trying to apply a quote:

ERROR: 2017-07-07 23:38:08,246: apply_quote() 'Could not apply quote:'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/variety/VarietyWindow.py", line 1259, in apply_quote
    QuoteWriter.write_quote(self.quote["quote"], self.quote.get("author", None), to_set, quote_outfile, self.options)
  File "/usr/lib/python2.7/site-packages/variety/QuoteWriter.py", line 46, in write_quote
    raise exception[0]
IOError: cannot write mode RGBA as JPEG

This seems to be caused by the following change:

"Before Pillow 4.2.0, attempting to save an RGBA image as JPEG would discard the alpha channel. From Pillow 3.4.0, a deprecation warning was shown. From Pillow 4.2.0, the deprecation warning is removed and an :py:exc:`IOError` is raised." (https://github.com/python-pillow/Pillow/blob/master/docs/releasenotes/4.2.0.rst#removed-deprecated-items)

Explicitly converting the image-with-quote to RGB before saving seems to solve the issue (patch attached)

Revision history for this message
Elon Bing (elonbing) wrote :
Revision history for this message
James Lu (jlu5) wrote :

Looks good, and there are no apparent side effects on older (4.x) versions of Pillow. Merged in https://bazaar.launchpad.net/~variety/variety/trunk/revision/595, thanks!

Changed in variety:
status: New → Fix Committed
importance: Undecided → Medium
James Lu (jlu5)
Changed in variety:
importance: Medium → High
James Lu (jlu5)
Changed in variety:
milestone: none → 0.6.5
status: Fix Committed → Fix Released
James Lu (jlu5)
Changed in variety:
assignee: nobody → James Lu (tacocat)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.