From 7a7a2bc10b95419a48090af3c0648502aaa9b557 Mon Sep 17 00:00:00 2001 From: Ciro Mattia Gonano Date: Tue, 12 Mar 2013 16:47:11 +0100 Subject: [PATCH 1/2] Don't set topmost as we don't want GUI to be ALWAYS on top --- kcc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kcc.py b/kcc.py index 158afad..3ec5d11 100644 --- a/kcc.py +++ b/kcc.py @@ -30,7 +30,7 @@ root = Tk() root.resizable(width=False, height=False) root.config(padx=5, pady=5, takefocus=True) root.title("Kindle Comic Converter v" + __version__) -root.wm_attributes("-topmost", 1) +#root.wm_attributes("-topmost", 1) if platform == 'darwin': os.environ['PATH'] = '/usr/local/bin:' + os.environ['PATH'] elif platform == 'win32': From c2cfc9b8dbc2c0c90f8663bc43622792f28a4b39 Mon Sep 17 00:00:00 2001 From: Ciro Mattia Gonano Date: Tue, 12 Mar 2013 16:54:14 +0100 Subject: [PATCH 2/2] Apply the correct ordering for image processing (closes #33, thanks to @devernay) --- kcc/comic2ebook.py | 2 +- kcc/image.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index e1fd41f..dee5078 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -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() diff --git a/kcc/image.py b/kcc/image.py index 8eeae69..94febca 100755 --- a/kcc/image.py +++ b/kcc/image.py @@ -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)