Skip to content

Commit

Permalink
Add gamma to input settings
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw committed Nov 8, 2020
1 parent 401e101 commit 1a8769e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
8 changes: 5 additions & 3 deletions kindle_comics_input/__init__.py
Expand Up @@ -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)
Expand All @@ -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):
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 10 additions & 2 deletions kindle_comics_input/kindle_comics_input.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion kindle_comics_output/__init__.py
Expand Up @@ -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']

Expand Down

0 comments on commit 1a8769e

Please sign in to comment.