From 5a500f7e1c4a33dd6c3779233b222d3fb42f975a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 27 Jan 2016 14:27:56 +0530 Subject: [PATCH] Fix #1538451 [AttributeError: 'QImage' object has no attribute 'setFormat'](https://bugs.launchpad.net/calibre/+bug/1538451) --- src/calibre/gui2/tweak_book/editor/canvas.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/tweak_book/editor/canvas.py b/src/calibre/gui2/tweak_book/editor/canvas.py index 87778b3ad2..a871c08fde 100644 --- a/src/calibre/gui2/tweak_book/editor/canvas.py +++ b/src/calibre/gui2/tweak_book/editor/canvas.py @@ -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