From 1a8769e97c1bc7f5abe7234979efc1c7bad05e81 Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Sun, 8 Nov 2020 01:28:23 +0100 Subject: [PATCH] Add gamma to input settings --- kindle_comics_input/__init__.py | 8 +++++--- kindle_comics_input/kindle_comics_input.py | 12 ++++++++++-- kindle_comics_output/__init__.py | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/kindle_comics_input/__init__.py b/kindle_comics_input/__init__.py index 7384591..2a48884 100644 --- a/kindle_comics_input/__init__.py +++ b/kindle_comics_input/__init__.py @@ -8,7 +8,7 @@ class KindleComics(InputFormatPlugin): author = 'Pavel Zwerschke' supported_platforms = ['windows', 'osx', 'linux'] file_types = {'cbz', 'cbr'} - version = (0, 0, 1) + version = (0, 0, 2) description = 'Converts cbz and cbr files into a kindle format that is actually readable on Kindle devices.' minimum_calibre_version = (5, 0, 0) @@ -25,7 +25,9 @@ class KindleComics(InputFormatPlugin): OptionRecommendation(name='max_width', recommended_value="1264", help='Maximum width.'), OptionRecommendation(name='max_height', recommended_value="1680", - help='Maximum height.') + help='Maximum height.'), + OptionRecommendation(name='gamma', recommended_value="1.0", + help='Gamma correction. 0 means automatic.') } def gui_configuration_widget(self, parent, get_option_by_name, get_option_help, db, book_id=None): @@ -91,7 +93,7 @@ def _convert_options_to_dict(options): 'hq': False, 'forcecolor': options.no_greyscale, 'forcepng': False, - 'gamma': 0.0, + 'gamma': float(options.gamma), 'stretch': False, 'kfx': False, 'upscale': False, diff --git a/kindle_comics_input/kindle_comics_input.py b/kindle_comics_input/kindle_comics_input.py index e57b752..1b1dbda 100644 --- a/kindle_comics_input/kindle_comics_input.py +++ b/kindle_comics_input/kindle_comics_input.py @@ -17,8 +17,8 @@ def __init__(self, parent, get_option, get_help, db=None, book_id=None): self.book_id = book_id # book_id is set for individual conversion, but not bulk # todo webtoon - # Widget.__init__(self, parent, ["manga", "webtoon", "margins", "no_greyscale", "max_width", "max_height"]) - Widget.__init__(self, parent, ["manga", "margins", "no_greyscale", "max_width", "max_height"]) + # Widget.__init__(self, parent, ["manga", "webtoon", "margins", "no_greyscale", "max_width", "max_height", "gamma"]) + Widget.__init__(self, parent, ["manga", "margins", "no_greyscale", "max_width", "max_height", "gamma"]) self.initialize_options(get_option, get_help, db, book_id) def setupUi(self, Form): @@ -74,4 +74,12 @@ def setupUi(self, Form): self.opt_max_height.setObjectName("max_height") self.formLayout.addRow(self.opt_max_height) + # Gamma + self.max_gamma_label = QLabel('Gamma:') + self.formLayout.addRow(self.max_gamma_label) + + self.opt_gamma = QtWidgets.QLineEdit(Form) + self.opt_gamma.setObjectName("gamma") + self.formLayout.addRow(self.opt_gamma) + QtCore.QMetaObject.connectSlotsByName(Form) diff --git a/kindle_comics_output/__init__.py b/kindle_comics_output/__init__.py index 3aa1ba7..cabf111 100644 --- a/kindle_comics_output/__init__.py +++ b/kindle_comics_output/__init__.py @@ -14,7 +14,7 @@ class KindleComicsOutput(OutputFormatPlugin): name = "Kindle Comics Output" author = "Pavel Zwerschke" file_type = "mobi" - version = (0, 0, 1) + version = (0, 0, 2) minimum_calibre_version = (5, 0, 0) supported_platforms = ['windows', 'osx', 'linux']