diff --git a/src/calibre/ebooks/comic/input.py b/src/calibre/ebooks/comic/input.py index c039b06676..f0acfe3a06 100755 --- a/src/calibre/ebooks/comic/input.py +++ b/src/calibre/ebooks/comic/input.py @@ -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 diff --git a/src/calibre/gui2/convert/comic_input.py b/src/calibre/gui2/convert/comic_input.py index e53d169e9a..bfa5eb5c63 100644 --- a/src/calibre/gui2/convert/comic_input.py +++ b/src/calibre/gui2/convert/comic_input.py @@ -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() diff --git a/src/calibre/gui2/convert/comic_input.ui b/src/calibre/gui2/convert/comic_input.ui index 2ca98fa7b4..f4f2d35e91 100644 --- a/src/calibre/gui2/convert/comic_input.ui +++ b/src/calibre/gui2/convert/comic_input.ui @@ -7,7 +7,7 @@ 0 0 599 - 305 + 343 @@ -100,7 +100,7 @@ - + Qt::Vertical @@ -120,6 +120,19 @@ + + + + &Output format: + + + opt_output_format + + + + + + @@ -263,8 +276,8 @@ 15 - 52 - 225 + 56 + 248 @@ -300,5 +313,21 @@ + + opt_no_process + toggled(bool) + opt_output_format + setDisabled(bool) + + + 237 + 12 + + + 370 + 308 + + +