mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Comic Input: Change default colors to 256 and add option to generate comic pages in PNG or JPEG formats. Fixes #3529 (Comics display badly on Adobe Digital Editions and some prs-505 models due to colour depth)
This commit is contained in:
parent
ffc7042af4
commit
d31192ece3
@ -173,7 +173,7 @@ class PageProcessor(list):
|
||||
p.MagickDespeckleImage(wand)
|
||||
|
||||
p.MagickQuantizeImage(wand, self.opts.colors, p.RGBColorspace, 0, 1, 0)
|
||||
dest = '%d_%d.png'%(self.num, i)
|
||||
dest = '%d_%d.%s'%(self.num, i, self.opts.output_format)
|
||||
dest = os.path.join(self.dest, dest)
|
||||
p.MagickWriteImage(wand, dest+'8')
|
||||
os.rename(dest+'8', dest)
|
||||
@ -270,8 +270,10 @@ class ComicInput(InputFormatPlugin):
|
||||
is_image_collection = True
|
||||
|
||||
options = set([
|
||||
OptionRecommendation(name='colors', recommended_value=64,
|
||||
help=_('Number of colors for grayscale image conversion. Default: %default')),
|
||||
OptionRecommendation(name='colors', recommended_value=256,
|
||||
help=_('Number of colors for grayscale image conversion. Default: '
|
||||
'%default. Values of less than 256 may result in blurred text '
|
||||
'on your device if you are creating your comics in EPUB format.')),
|
||||
OptionRecommendation(name='dont_normalize', recommended_value=False,
|
||||
help=_('Disable normalize (improve contrast) color range '
|
||||
'for pictures. Default: False')),
|
||||
@ -298,6 +300,10 @@ class ComicInput(InputFormatPlugin):
|
||||
help=_("Don't sort the files found in the comic "
|
||||
"alphabetically by name. Instead use the order they were "
|
||||
"added to the comic.")),
|
||||
OptionRecommendation(name='output_format', choices=['png', 'jpg'],
|
||||
recommended_value='png', help=_('The format that images in the created ebook '
|
||||
'are converted to. You can experiment to see which format gives '
|
||||
'you optimal size and look on your device.')),
|
||||
OptionRecommendation(name='no_process', recommended_value=False,
|
||||
help=_("Apply no processing to the image")),
|
||||
])
|
||||
@ -365,7 +371,8 @@ class ComicInput(InputFormatPlugin):
|
||||
'(run with --verbose to see why):')
|
||||
for f in failures:
|
||||
self.log.warning('\t', f)
|
||||
thumbnail = os.path.join(tdir2, 'thumbnail.png')
|
||||
thumbnail = os.path.join(tdir2,
|
||||
'thumbnail.'+self.opts.output_format.lower())
|
||||
if not os.access(thumbnail, os.R_OK):
|
||||
thumbnail = None
|
||||
return new_pages
|
||||
|
@ -19,9 +19,11 @@ class PluginWidget(Widget, Ui_Form):
|
||||
Widget.__init__(self, parent, 'comic_input',
|
||||
['colors', 'dont_normalize', 'keep_aspect_ratio', 'right2left',
|
||||
'despeckle', 'no_sort', 'no_process', 'landscape',
|
||||
'dont_sharpen', 'disable_trim', 'wide']
|
||||
'dont_sharpen', 'disable_trim', 'wide', 'output_format']
|
||||
)
|
||||
self.db, self.book_id = db, book_id
|
||||
for x in get_option('output_format').option.choices:
|
||||
self.opt_output_format.addItem(x)
|
||||
self.initialize_options(get_option, get_help, db, book_id)
|
||||
self.opt_no_process.toggle()
|
||||
self.opt_no_process.toggle()
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>599</width>
|
||||
<height>305</height>
|
||||
<height>343</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -100,7 +100,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<item row="12" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -120,6 +120,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>&Output format:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>opt_output_format</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QComboBox" name="opt_output_format"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
@ -263,8 +276,8 @@
|
||||
<y>15</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>52</x>
|
||||
<y>225</y>
|
||||
<x>56</x>
|
||||
<y>248</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@ -300,5 +313,21 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>opt_no_process</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>opt_output_format</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>237</x>
|
||||
<y>12</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>370</x>
|
||||
<y>308</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
Loading…
x
Reference in New Issue
Block a user