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.autocontrastImage()
|
||||||
img.resizeImage()
|
img.resizeImage()
|
||||||
img.optimizeForDisplay(opt.reducerainbow)
|
img.optimizeForDisplay(opt.reducerainbow)
|
||||||
if not opt.forcecolor or (opt.forcecolor and not workImg.color):
|
if opt.forcecolor and workImg.color:
|
||||||
img.convertToGrayscaleOrQuantize()
|
pass
|
||||||
|
elif opt.forcepng:
|
||||||
|
img.quantizeImage()
|
||||||
|
else:
|
||||||
|
img.convertToGrayscale()
|
||||||
output.append(img.saveToDir())
|
output.append(img.saveToDir())
|
||||||
return output
|
return output
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@@ -351,11 +351,8 @@ class ComicPage:
|
|||||||
else:
|
else:
|
||||||
self.image = ImageOps.autocontrast(Image.eval(self.image, lambda a: int(255 * (a / 255.) ** gamma)))
|
self.image = ImageOps.autocontrast(Image.eval(self.image, lambda a: int(255 * (a / 255.) ** gamma)))
|
||||||
|
|
||||||
def convertToGrayscaleOrQuantize(self):
|
def convertToGrayscale(self):
|
||||||
if self.opt.forcepng:
|
self.image = self.image.convert('L')
|
||||||
self.quantizeImage()
|
|
||||||
else:
|
|
||||||
self.image = self.image.convert('L')
|
|
||||||
|
|
||||||
def quantizeImage(self):
|
def quantizeImage(self):
|
||||||
palImg = Image.new('P', (1, 1))
|
palImg = Image.new('P', (1, 1))
|
||||||
|
|||||||
Reference in New Issue
Block a user