From 9d72a1c3eb736e0f490eac5c00015849ff787490 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 4 May 2016 20:16:11 +0530 Subject: [PATCH] Remove IM from SNB Output --- src/calibre/ebooks/conversion/plugins/snb_output.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/calibre/ebooks/conversion/plugins/snb_output.py b/src/calibre/ebooks/conversion/plugins/snb_output.py index e9b8af0db6..87115dfd37 100644 --- a/src/calibre/ebooks/conversion/plugins/snb_output.py +++ b/src/calibre/ebooks/conversion/plugins/snb_output.py @@ -228,10 +228,9 @@ def convert(self, oeb_book, output_path, input_plugin, opts, log): snbFile.Output(output_path) def HandleImage(self, imageData, imagePath): - from calibre.utils.magick import Image - img = Image() - img.load(imageData) - (x,y) = img.size + from calibre.utils.img import image_from_data, resize_image, image_to_data + img = image_from_data(imageData) + x, y = img.width(), img.height() if self.opts: if self.opts.snb_full_screen: SCREEN_X, SCREEN_Y = self.opts.output_profile.screen_size @@ -248,8 +247,9 @@ def HandleImage(self, imageData, imagePath): # TODO : intelligent image rotation # img = img.rotate(90) # x,y = y,x - img.size = (x / scale, y / scale) - img.save(imagePath) + img = resize_image(img, x / scale, y / scale) + with lopen(imagePath, 'wb') as f: + f.write(image_to_data(img, fmt=imagePath.rpartition('.')[-1])) if __name__ == '__main__': from calibre.ebooks.oeb.reader import OEBReader