diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index fd66a23..619b026 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -254,7 +254,7 @@ def applyImgOptimization(img, isSplit=False, toRight=False): img.cropWhiteSpace(10.0) if options.cutpagenumbers: img.cutPageNumber() - img.resizeImage(options.upscale, options.stretch, options.black_borders, isSplit, toRight, options.profile) + img.resizeImage(options.upscale, options.stretch, options.black_borders, isSplit, toRight) img.quantizeImage() diff --git a/kcc/image.py b/kcc/image.py index 55e9086..6f52471 100755 --- a/kcc/image.py +++ b/kcc/image.py @@ -100,6 +100,7 @@ class ProfileData: class ComicPage: def __init__(self, source, device): try: + self.profile = device self.profile_label, self.size, self.palette = ProfileData.Profiles[device] except KeyError: raise RuntimeError('Unexpected output device %s' % device) @@ -129,7 +130,7 @@ class ComicPage: palImg.putpalette(self.palette) self.image = self.image.quantize(palette=palImg) - def resizeImage(self, upscale=False, stretch=False, black_borders=False, isSplit=False, toRight=False, profile="KHD"): + def resizeImage(self, upscale=False, stretch=False, black_borders=False, isSplit=False, toRight=False): method = Image.ANTIALIAS if black_borders: fill = 'black' @@ -137,7 +138,7 @@ class ComicPage: fill = 'white' if self.image.size[0] <= self.size[0] and self.image.size[1] <= self.size[1]: if not upscale: - if isSplit and (profile == 'K4' or profile == 'KHD'): + if isSplit and (self.profile == 'K4' or self.profile == 'KHD'): borderw = (self.size[0] - self.image.size[0]) borderh = (self.size[1] - self.image.size[1]) / 2 self.image = ImageOps.expand(self.image, border=(0, borderh), fill=fill) @@ -162,7 +163,7 @@ class ComicPage: ratioDev = float(self.size[0]) / float(self.size[1]) if (float(self.image.size[0]) / float(self.image.size[1])) < ratioDev: diff = int(self.image.size[1] * ratioDev) - self.image.size[0] - if isSplit and (profile == 'K4' or profile == 'KHD'): + if isSplit and (self.profile == 'K4' or self.profile == 'KHD'): diff = 2 self.image = ImageOps.expand(self.image, border=(diff / 2, 0), fill=fill) elif (float(self.image.size[0]) / float(self.image.size[1])) > ratioDev: