mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Comic Input: Do not rescale images when using the Tablet output profile (or any output profile with a screen size larger than 3000x3000)
This commit is contained in:
parent
9cc07e620d
commit
60a2e50b9f
@ -17,6 +17,10 @@ from calibre.ptempfile import PersistentTemporaryDirectory
|
|||||||
from calibre.utils.ipc.server import Server
|
from calibre.utils.ipc.server import Server
|
||||||
from calibre.utils.ipc.job import ParallelJob
|
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):
|
def extract_comic(path_to_comic_file):
|
||||||
'''
|
'''
|
||||||
Un-archive the comic file.
|
Un-archive the comic file.
|
||||||
@ -141,7 +145,7 @@ class PageProcessor(list): # {{{
|
|||||||
newsizey = int(newsizex / aspect)
|
newsizey = int(newsizex / aspect)
|
||||||
deltax = 0
|
deltax = 0
|
||||||
deltay = (SCRHEIGHT - newsizey) / 2
|
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
|
# Too large and resizing fails, so better
|
||||||
# to leave it as original size
|
# to leave it as original size
|
||||||
wand.size = (newsizex, newsizey)
|
wand.size = (newsizex, newsizey)
|
||||||
@ -165,14 +169,14 @@ class PageProcessor(list): # {{{
|
|||||||
newsizey = int(newsizex / aspect)
|
newsizey = int(newsizex / aspect)
|
||||||
deltax = 0
|
deltax = 0
|
||||||
deltay = (wscreeny - newsizey) / 2
|
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
|
# Too large and resizing fails, so better
|
||||||
# to leave it as original size
|
# to leave it as original size
|
||||||
wand.size = (newsizex, newsizey)
|
wand.size = (newsizex, newsizey)
|
||||||
wand.set_border_color(pw)
|
wand.set_border_color(pw)
|
||||||
wand.add_border(pw, deltax, deltay)
|
wand.add_border(pw, deltax, deltay)
|
||||||
else:
|
else:
|
||||||
if SCRWIDTH < 20000 and SCRHEIGHT < 20000:
|
if SCRWIDTH < MAX_SCREEN_SIZE and SCRHEIGHT < MAX_SCREEN_SIZE:
|
||||||
wand.size = (SCRWIDTH, SCRHEIGHT)
|
wand.size = (SCRWIDTH, SCRHEIGHT)
|
||||||
|
|
||||||
if not self.opts.dont_sharpen:
|
if not self.opts.dont_sharpen:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user