From d9ea165bbbb795bea67ec472d7f345332d77dd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Mon, 29 Apr 2013 17:19:06 +0200 Subject: [PATCH 1/5] Experimental support of Kindle Fire --- kcc/comic2ebook.py | 14 ++++++++++---- kcc/image.py | 15 +++++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index 6be5da3..235ba96 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -342,17 +342,17 @@ def dirImgProcess(path): facing = "left" img0 = image.ComicPage(split[0], options.profile) applyImgOptimization(img0, True, toRight1) - img0.saveToDir(dirpath, options.forcepng) + img0.saveToDir(dirpath, options.forcepng, options.forcecolor) img1 = image.ComicPage(split[1], options.profile) applyImgOptimization(img1, True, toRight2) - img1.saveToDir(dirpath, options.forcepng) + img1.saveToDir(dirpath, options.forcepng, options.forcecolor) else: if facing == "right": facing = "left" else: facing = "right" applyImgOptimization(img) - img.saveToDir(dirpath, options.forcepng) + img.saveToDir(dirpath, options.forcepng, options.forcecolor) def genEpubStruct(path): @@ -678,8 +678,14 @@ def checkOptions(): else: #Virtual Panel View options.panelview = False - if options.profile == 'K1' or options.profile == 'K2' or options.profile == 'KDX' or options.profile == 'KDXG': + if options.profile == 'K1' or options.profile == 'K2' or options.profile == 'KDX' or options.profile == 'KDXG' or options.profile == 'KF' or options.profile == 'KFHD' or options.profile == 'KFHD8': options.nopanelviewhq = True + if options.profile == 'KF' or options.profile == 'KFHD' or options.profile == 'KFHD8': + options.upscale = True + options.forcecolor = True + options.forcepng = False + else: + options.forcecolor = False def getEpubPath(): diff --git a/kcc/image.py b/kcc/image.py index 3876650..896058a 100755 --- a/kcc/image.py +++ b/kcc/image.py @@ -84,7 +84,10 @@ class ProfileData: 'K4T': ("Kindle Touch", (600, 800), Palette16, 1.8, (900, 1200)), 'KHD': ("Kindle Paperwhite", (758, 1024), Palette16, 1.8, (1137, 1536)), 'KDX': ("Kindle DX", (824, 1200), Palette15, 1.8, (1236, 1800)), - 'KDXG': ("Kindle DXG", (824, 1200), Palette16, 1.8, (1236, 1800)) + 'KDXG': ("Kindle DXG", (824, 1200), Palette16, 1.8, (1236, 1800)), + 'KF': ("Kindle Fire", (600, 1024), Palette16, 1.0, (900, 1536)), + 'KFHD': ("Kindle Fire HD 7\"", (800, 1280), Palette16, 1.0, (1200, 1920)), + 'KFHD8': ("Kindle Fire HD 8.9\"", (1200, 1920), Palette16, 1.0, (1800, 2880)) } ProfileLabels = { @@ -95,7 +98,10 @@ class ProfileData: "Kindle 4/Touch": 'K4T', "Kindle Paperwhite": 'KHD', "Kindle DX": 'KDX', - "Kindle DXG": 'KDXG' + "Kindle DXG": 'KDXG', + "Kindle Fire": 'KF', + "Kindle Fire HD 7\"": 'KFHD', + "Kindle Fire HD 8.9\"": 'KFHD8' } @@ -113,10 +119,11 @@ class ComicPage: raise RuntimeError('Cannot read image file %s' % source) self.image = self.image.convert('RGB') - def saveToDir(self, targetdir, forcepng): + def saveToDir(self, targetdir, forcepng, color): filename = os.path.basename(self.origFileName) try: - self.image = self.image.convert('L') # convert to grayscale + if not color: + self.image = self.image.convert('L') # convert to grayscale os.remove(os.path.join(targetdir, filename)) if forcepng: self.image.save(os.path.join(targetdir, os.path.splitext(filename)[0] + ".png"), "PNG") From 7e191c0be5cb1883b79efa747ea6d36c4503a369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Mon, 29 Apr 2013 17:51:14 +0200 Subject: [PATCH 2/5] Experimental support of Kindle Fire - Tweaks --- kcc/comic2ebook.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index 235ba96..05ba0af 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -586,7 +586,8 @@ def main(argv=None): usage = "Usage: %prog [options] comic_file|comic_folder" parser = OptionParser(usage=usage, version=__version__) parser.add_option("-p", "--profile", action="store", dest="profile", default="KHD", - help="Device profile (Choose one among K1, K2, K3, K4NT, K4T, KDX, KDXG or KHD) [Default=KHD]") + help="Device profile (Choose one among K1, K2, K3, K4NT, K4T, KDX, KDXG, KHD, KF, KFHD, KFHD8) " + "[Default=KHD]") parser.add_option("-t", "--title", action="store", dest="title", default="defaulttitle", help="Comic title [Default=filename]") parser.add_option("-m", "--manga-style", action="store_true", dest="righttoleft", default=False, @@ -678,7 +679,8 @@ def checkOptions(): else: #Virtual Panel View options.panelview = False - if options.profile == 'K1' or options.profile == 'K2' or options.profile == 'KDX' or options.profile == 'KDXG' or options.profile == 'KF' or options.profile == 'KFHD' or options.profile == 'KFHD8': + if options.profile == 'K1' or options.profile == 'K2' or options.profile == 'KDX' or options.profile == 'KDXG'\ + or options.profile == 'KF' or options.profile == 'KFHD' or options.profile == 'KFHD8': options.nopanelviewhq = True if options.profile == 'KF' or options.profile == 'KFHD' or options.profile == 'KFHD8': options.upscale = True From a6eb3936e405293e2a4533a32f8374abe5071d7f Mon Sep 17 00:00:00 2001 From: Ciro Mattia Gonano Date: Tue, 30 Apr 2013 10:27:04 +0200 Subject: [PATCH 3/5] Don't force upscale on Kindle Fire (let users choose if they want it) --- kcc/comic2ebook.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index 05ba0af..b64792b 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -656,8 +656,7 @@ def getOutputFilename(srcpath, wantedname, ext): elif os.path.isdir(srcpath): filename = os.path.abspath(options.output) + "/" + os.path.basename(srcpath) + ext else: - filename = os.path.abspath(options.output) + "/" \ - + os.path.basename(os.path.splitext(srcpath)[0]) + ext + filename = os.path.abspath(options.output) + "/" + os.path.basename(os.path.splitext(srcpath)[0]) + ext elif os.path.isdir(srcpath): filename = srcpath + ext else: @@ -683,9 +682,7 @@ def checkOptions(): or options.profile == 'KF' or options.profile == 'KFHD' or options.profile == 'KFHD8': options.nopanelviewhq = True if options.profile == 'KF' or options.profile == 'KFHD' or options.profile == 'KFHD8': - options.upscale = True options.forcecolor = True - options.forcepng = False else: options.forcecolor = False From 7e6c8cc768c2b3bc6b4719505305d58a329d715d Mon Sep 17 00:00:00 2001 From: Ciro Mattia Gonano Date: Tue, 30 Apr 2013 10:29:40 +0200 Subject: [PATCH 4/5] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6422cad..8ca81a7 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,7 @@ The app relies and includes the following scripts/binaries: Rarfile library updated to 2.6 Added GIF, TIFF and BMP to supported formats (#42) Filenames slugifications (#28, #31, #9, #8) + - 2.10: Kindle Fire support (color ePub/Mobi) ## COPYRIGHT From 18993069e3e0e129e03ecd4836f1d60ada7ce324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Tue, 30 Apr 2013 12:57:32 +0200 Subject: [PATCH 5/5] Quantization must be disabled. --- kcc/comic2ebook.py | 1 + 1 file changed, 1 insertion(+) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index b64792b..baa6b17 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -683,6 +683,7 @@ def checkOptions(): options.nopanelviewhq = True if options.profile == 'KF' or options.profile == 'KFHD' or options.profile == 'KFHD8': options.forcecolor = True + options.forcepng = False else: options.forcecolor = False