mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Comic Input: Add option to disable conversion to grayscale (black and white)
This commit is contained in:
parent
799c647c8d
commit
9b8edf21a2
@ -171,7 +171,8 @@ class PageProcessor(list):
|
|||||||
if not self.opts.dont_sharpen:
|
if not self.opts.dont_sharpen:
|
||||||
p.MagickSharpenImage(wand, 0.0, 1.0)
|
p.MagickSharpenImage(wand, 0.0, 1.0)
|
||||||
|
|
||||||
p.MagickSetImageType(wand, p.GrayscaleType)
|
if not self.opts.dont_grayscale:
|
||||||
|
p.MagickSetImageType(wand, p.GrayscaleType)
|
||||||
|
|
||||||
if self.opts.despeckle:
|
if self.opts.despeckle:
|
||||||
p.MagickDespeckleImage(wand)
|
p.MagickDespeckleImage(wand)
|
||||||
@ -310,6 +311,8 @@ class ComicInput(InputFormatPlugin):
|
|||||||
'you optimal size and look on your device.')),
|
'you optimal size and look on your device.')),
|
||||||
OptionRecommendation(name='no_process', recommended_value=False,
|
OptionRecommendation(name='no_process', recommended_value=False,
|
||||||
help=_("Apply no processing to the image")),
|
help=_("Apply no processing to the image")),
|
||||||
|
OptionRecommendation(name='dont_grayscale', recommended_value=False,
|
||||||
|
help=_('Do not convert the image to grayscale (black and white)'))
|
||||||
])
|
])
|
||||||
|
|
||||||
recommendations = set([
|
recommendations = set([
|
||||||
|
@ -19,7 +19,8 @@ class PluginWidget(Widget, Ui_Form):
|
|||||||
Widget.__init__(self, parent, 'comic_input',
|
Widget.__init__(self, parent, 'comic_input',
|
||||||
['colors', 'dont_normalize', 'keep_aspect_ratio', 'right2left',
|
['colors', 'dont_normalize', 'keep_aspect_ratio', 'right2left',
|
||||||
'despeckle', 'no_sort', 'no_process', 'landscape',
|
'despeckle', 'no_sort', 'no_process', 'landscape',
|
||||||
'dont_sharpen', 'disable_trim', 'wide', 'output_format']
|
'dont_sharpen', 'disable_trim', 'wide', 'output_format',
|
||||||
|
'dont_grayscale']
|
||||||
)
|
)
|
||||||
self.db, self.book_id = db, book_id
|
self.db, self.book_id = db, book_id
|
||||||
for x in get_option('output_format').option.choices:
|
for x in get_option('output_format').option.choices:
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>599</width>
|
<width>599</width>
|
||||||
<height>343</height>
|
<height>345</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Number of Colors:</string>
|
<string>&Number of Colors:</string>
|
||||||
@ -24,83 +24,83 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QSpinBox" name="opt_colors">
|
<widget class="QSpinBox" name="opt_colors">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>8</number>
|
<number>8</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>3200000</number>
|
<number>32000000</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="singleStep">
|
<property name="singleStep">
|
||||||
<number>8</number>
|
<number>8</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QCheckBox" name="opt_dont_normalize">
|
<widget class="QCheckBox" name="opt_dont_normalize">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Disable &normalize</string>
|
<string>Disable &normalize</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="opt_keep_aspect_ratio">
|
<widget class="QCheckBox" name="opt_keep_aspect_ratio">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Keep &aspect ratio</string>
|
<string>Keep &aspect ratio</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QCheckBox" name="opt_dont_sharpen">
|
<widget class="QCheckBox" name="opt_dont_sharpen">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Disable &Sharpening</string>
|
<string>Disable &Sharpening</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QCheckBox" name="opt_disable_trim">
|
<widget class="QCheckBox" name="opt_disable_trim">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Disable &Trimming</string>
|
<string>Disable &Trimming</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QCheckBox" name="opt_wide">
|
<widget class="QCheckBox" name="opt_wide">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Wide</string>
|
<string>&Wide</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="8" column="0">
|
||||||
<widget class="QCheckBox" name="opt_landscape">
|
<widget class="QCheckBox" name="opt_landscape">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Landscape</string>
|
<string>&Landscape</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="9" column="0">
|
||||||
<widget class="QCheckBox" name="opt_right2left">
|
<widget class="QCheckBox" name="opt_right2left">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Right to left</string>
|
<string>&Right to left</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
<item row="10" column="0">
|
||||||
<widget class="QCheckBox" name="opt_no_sort">
|
<widget class="QCheckBox" name="opt_no_sort">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Don't so&rt</string>
|
<string>Don't so&rt</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0">
|
<item row="11" column="0">
|
||||||
<widget class="QCheckBox" name="opt_despeckle">
|
<widget class="QCheckBox" name="opt_despeckle">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>De&speckle</string>
|
<string>De&speckle</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="0">
|
<item row="13" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -120,7 +120,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="0">
|
<item row="12" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Output format:</string>
|
<string>&Output format:</string>
|
||||||
@ -130,9 +130,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="1">
|
<item row="12" column="1">
|
||||||
<widget class="QComboBox" name="opt_output_format"/>
|
<widget class="QComboBox" name="opt_output_format"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="opt_dont_grayscale">
|
||||||
|
<property name="text">
|
||||||
|
<string>Disable conversion of images to &black and white</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
@ -148,8 +155,8 @@
|
|||||||
<y>11</y>
|
<y>11</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>210</x>
|
<x>216</x>
|
||||||
<y>44</y>
|
<y>76</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@ -164,8 +171,8 @@
|
|||||||
<y>17</y>
|
<y>17</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>371</x>
|
<x>592</x>
|
||||||
<y>39</y>
|
<y>76</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@ -180,8 +187,8 @@
|
|||||||
<y>15</y>
|
<y>15</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>20</x>
|
<x>26</x>
|
||||||
<y>67</y>
|
<y>101</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@ -196,8 +203,8 @@
|
|||||||
<y>11</y>
|
<y>11</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>38</x>
|
<x>44</x>
|
||||||
<y>98</y>
|
<y>126</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@ -212,8 +219,8 @@
|
|||||||
<y>12</y>
|
<y>12</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>110</x>
|
<x>116</x>
|
||||||
<y>124</y>
|
<y>151</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@ -224,12 +231,12 @@
|
|||||||
<slot>setDisabled(bool)</slot>
|
<slot>setDisabled(bool)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>153</x>
|
<x>159</x>
|
||||||
<y>5</y>
|
<y>11</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>67</x>
|
<x>73</x>
|
||||||
<y>155</y>
|
<y>176</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@ -244,8 +251,8 @@
|
|||||||
<y>13</y>
|
<y>13</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>84</x>
|
<x>90</x>
|
||||||
<y>180</y>
|
<y>201</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@ -292,8 +299,8 @@
|
|||||||
<y>11</y>
|
<y>11</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>105</x>
|
<x>111</x>
|
||||||
<y>256</y>
|
<y>276</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
@ -329,5 +336,21 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>opt_no_process</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>opt_dont_grayscale</receiver>
|
||||||
|
<slot>setDisabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>229</x>
|
||||||
|
<y>22</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>231</x>
|
||||||
|
<y>36</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -299,6 +299,11 @@ class StanzaPage(QWizardPage, StanzaUI):
|
|||||||
return FinishPage.ID
|
return FinishPage.ID
|
||||||
|
|
||||||
def commit(self):
|
def commit(self):
|
||||||
|
from calibre.ebooks.conversion.config import load_defaults, save_defaults
|
||||||
|
recs = load_defaults('comic_input')
|
||||||
|
recs['dont_grayscale'] = True
|
||||||
|
save_defaults('comic_input', recs)
|
||||||
|
|
||||||
p = self.set_port()
|
p = self.set_port()
|
||||||
if p is not None:
|
if p is not None:
|
||||||
from calibre.library import server_config
|
from calibre.library import server_config
|
||||||
|
Loading…
x
Reference in New Issue
Block a user