mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 01:36:27 +00:00
Improve code readability (#984)
This commit is contained in:
@@ -642,8 +642,12 @@ def imgFileProcessing(work):
|
||||
img.autocontrastImage()
|
||||
img.resizeImage()
|
||||
img.optimizeForDisplay(opt.reducerainbow)
|
||||
if not opt.forcecolor or (opt.forcecolor and not workImg.color):
|
||||
img.convertToGrayscaleOrQuantize()
|
||||
if opt.forcecolor and workImg.color:
|
||||
pass
|
||||
elif opt.forcepng:
|
||||
img.quantizeImage()
|
||||
else:
|
||||
img.convertToGrayscale()
|
||||
output.append(img.saveToDir())
|
||||
return output
|
||||
except Exception:
|
||||
|
||||
@@ -351,10 +351,7 @@ class ComicPage:
|
||||
else:
|
||||
self.image = ImageOps.autocontrast(Image.eval(self.image, lambda a: int(255 * (a / 255.) ** gamma)))
|
||||
|
||||
def convertToGrayscaleOrQuantize(self):
|
||||
if self.opt.forcepng:
|
||||
self.quantizeImage()
|
||||
else:
|
||||
def convertToGrayscale(self):
|
||||
self.image = self.image.convert('L')
|
||||
|
||||
def quantizeImage(self):
|
||||
|
||||
Reference in New Issue
Block a user