mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1538451 [AttributeError: 'QImage' object has no attribute 'setFormat'](https://bugs.launchpad.net/calibre/+bug/1538451)
This commit is contained in:
parent
7a18787eda
commit
5a500f7e1c
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user