1
0
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:
Ciro Mattia Gonano
2013-03-12 16:54:14 +01:00
parent 7a7a2bc10b
commit c2cfc9b8db
2 changed files with 3 additions and 1 deletions

View File

@@ -256,11 +256,11 @@ def isInFilelist(filename, filelist):
def applyImgOptimization(img, isSplit=False, toRight=False):
img.optimizeImage(options.gamma)
img.cropWhiteSpace(10.0)
if options.cutpagenumbers:
img.cutPageNumber()
img.resizeImage(options.upscale, options.stretch, options.black_borders, isSplit, toRight)
img.optimizeImage(options.gamma)
if not options.notquantize:
img.quantizeImage()

View File

@@ -132,6 +132,8 @@ class ComicPage:
self.image = ImageOps.autocontrast(Image.eval(self.image, lambda a: 255 * (a / 255.) ** gamma))
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
if colors < 256:
self.palette += self.palette[:3] * (256 - colors)