mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 01:36:27 +00:00
Apply the correct ordering for image processing (closes #33, thanks to @devernay)
This commit is contained in:
@@ -256,11 +256,11 @@ def isInFilelist(filename, filelist):
|
|||||||
|
|
||||||
|
|
||||||
def applyImgOptimization(img, isSplit=False, toRight=False):
|
def applyImgOptimization(img, isSplit=False, toRight=False):
|
||||||
img.optimizeImage(options.gamma)
|
|
||||||
img.cropWhiteSpace(10.0)
|
img.cropWhiteSpace(10.0)
|
||||||
if options.cutpagenumbers:
|
if options.cutpagenumbers:
|
||||||
img.cutPageNumber()
|
img.cutPageNumber()
|
||||||
img.resizeImage(options.upscale, options.stretch, options.black_borders, isSplit, toRight)
|
img.resizeImage(options.upscale, options.stretch, options.black_borders, isSplit, toRight)
|
||||||
|
img.optimizeImage(options.gamma)
|
||||||
if not options.notquantize:
|
if not options.notquantize:
|
||||||
img.quantizeImage()
|
img.quantizeImage()
|
||||||
|
|
||||||
|
|||||||
@@ -132,6 +132,8 @@ class ComicPage:
|
|||||||
self.image = ImageOps.autocontrast(Image.eval(self.image, lambda a: 255 * (a / 255.) ** gamma))
|
self.image = ImageOps.autocontrast(Image.eval(self.image, lambda a: 255 * (a / 255.) ** gamma))
|
||||||
|
|
||||||
def quantizeImage(self):
|
def quantizeImage(self):
|
||||||
|
self.image = self.image.convert('L') # convert to grayscale
|
||||||
|
self.image = self.image.convert("RGB") # convert back to RGB
|
||||||
colors = len(self.palette) / 3
|
colors = len(self.palette) / 3
|
||||||
if colors < 256:
|
if colors < 256:
|
||||||
self.palette += self.palette[:3] * (256 - colors)
|
self.palette += self.palette[:3] * (256 - colors)
|
||||||
|
|||||||
Reference in New Issue
Block a user