From 7ab2a87f5f30b58f2412cdc6b071f5300ef05d03 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 31 Oct 2016 00:22:47 +0530 Subject: [PATCH] Use the save_image() function to save images so we get an unhandled error if something goes wrong --- src/calibre/gui2/viewer/image_popup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/viewer/image_popup.py b/src/calibre/gui2/viewer/image_popup.py index a50cd68b1d..3799a49968 100644 --- a/src/calibre/gui2/viewer/image_popup.py +++ b/src/calibre/gui2/viewer/image_popup.py @@ -69,7 +69,8 @@ class ImageView(QDialog): _('Choose a file to save to'), filters=filters, all_files=False) if f: - self.current_img.save(f) + from calibre.utils.img import save_image + save_image(self.current_img.toImage(), f) def adjust_image(self, factor): self.label.resize(self.factor * self.current_img.size()) @@ -147,7 +148,8 @@ class ImagePopup(object): if __name__ == '__main__': import sys - app = QApplication([]) + from calibre.gui2 import Application + app = Application([]) p = QPixmap() p.load(sys.argv[-1]) u = QUrl.fromLocalFile(sys.argv[-1])