Fix #1538451 [AttributeError: 'QImage' object has no attribute 'setFormat'](https://bugs.launchpad.net/calibre/+bug/1538451)

This commit is contained in:
Kovid Goyal 2016-01-27 14:27:56 +05:30
parent 7a18787eda
commit 5a500f7e1c

View File

@ -97,13 +97,11 @@ def qimage_to_magick(img):
fmt = get_pixel_map()
if not img.hasAlphaChannel():
if img.format() != img.Format_RGB32:
img = QImage(img)
img.setFormat(QImage.Format_RGB32)
img = img.convertToFormat(QImage.Format_RGB32)
fmt = fmt.replace('A', 'P')
else:
if img.format() != img.Format_ARGB32:
img = QImage(img)
img.setFormat(img.Format_ARGB32)
img = img.convertToFormat(QImage.Format_ARGB32)
raw = img.constBits().ascapsule()
ans.constitute(img.width(), img.height(), fmt, raw)
return ans