From 60a2e50b9f52fd88382258c74c0c8453506f7ae0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 10 Dec 2011 14:11:19 +0530 Subject: [PATCH] Comic Input: Do not rescale images when using the Tablet output profile (or any output profile with a screen size larger than 3000x3000) --- src/calibre/ebooks/comic/input.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/comic/input.py b/src/calibre/ebooks/comic/input.py index f6833ca197..9fcfc559aa 100755 --- a/src/calibre/ebooks/comic/input.py +++ b/src/calibre/ebooks/comic/input.py @@ -17,6 +17,10 @@ from calibre.ptempfile import PersistentTemporaryDirectory from calibre.utils.ipc.server import Server from calibre.utils.ipc.job import ParallelJob +# If the specified screen has either dimension larger than this value, no image +# rescaling is done (we assume that it is a tablet output profile) +MAX_SCREEN_SIZE = 3000 + def extract_comic(path_to_comic_file): ''' Un-archive the comic file. @@ -141,7 +145,7 @@ class PageProcessor(list): # {{{ newsizey = int(newsizex / aspect) deltax = 0 deltay = (SCRHEIGHT - newsizey) / 2 - if newsizex < 20000 and newsizey < 20000: + if newsizex < MAX_SCREEN_SIZE and newsizey < MAX_SCREEN_SIZE: # Too large and resizing fails, so better # to leave it as original size wand.size = (newsizex, newsizey) @@ -165,14 +169,14 @@ class PageProcessor(list): # {{{ newsizey = int(newsizex / aspect) deltax = 0 deltay = (wscreeny - newsizey) / 2 - if newsizex < 20000 and newsizey < 20000: + if newsizex < MAX_SCREEN_SIZE and newsizey < MAX_SCREEN_SIZE: # Too large and resizing fails, so better # to leave it as original size wand.size = (newsizex, newsizey) wand.set_border_color(pw) wand.add_border(pw, deltax, deltay) else: - if SCRWIDTH < 20000 and SCRHEIGHT < 20000: + if SCRWIDTH < MAX_SCREEN_SIZE and SCRHEIGHT < MAX_SCREEN_SIZE: wand.size = (SCRWIDTH, SCRHEIGHT) if not self.opts.dont_sharpen: