Remove IM from SNB Output

This commit is contained in:
Kovid Goyal 2016-05-04 20:16:11 +05:30
parent e25d1220f3
commit 9d72a1c3eb

View file

@ -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