mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement #985 (comic2lrf, added a wide-aspect scaling option)
This commit is contained in:
commit
cf55451ecc
@ -159,6 +159,27 @@ class PageProcessor(list):
|
||||
MagickResizeImage(wand, newsizex, newsizey, CatromFilter, 1.0)
|
||||
MagickSetImageBorderColor(wand, pw)
|
||||
MagickBorderImage(wand, pw, deltax, deltay)
|
||||
elif self.opts.wide:
|
||||
# Keep aspect and Use device height as scaled image width so landscape mode is clean
|
||||
aspect = float(sizex) / float(sizey)
|
||||
screen_aspect = float(SCRWIDTH) / float(SCRHEIGHT)
|
||||
# Get dimensions of the landscape mode screen
|
||||
# Add 25px back to height for the battery bar.
|
||||
wscreenx = SCRHEIGHT + 25
|
||||
wscreeny = int(wscreenx / screen_aspect)
|
||||
if aspect <= screen_aspect:
|
||||
newsizey = wscreeny
|
||||
newsizex = int(newsizey * aspect)
|
||||
deltax = (wscreenx - newsizex) / 2
|
||||
deltay = 0
|
||||
else:
|
||||
newsizex = wscreenx
|
||||
newsizey = int(newsizex / aspect)
|
||||
deltax = 0
|
||||
deltay = (wscreeny - newsizey) / 2
|
||||
MagickResizeImage(wand, newsizex, newsizey, CatromFilter, 1.0)
|
||||
MagickSetImageBorderColor(wand, pw)
|
||||
MagickBorderImage(wand, pw, deltax, deltay)
|
||||
else:
|
||||
MagickResizeImage(wand, SCRWIDTH, SCRHEIGHT, CatromFilter, 1.0)
|
||||
|
||||
@ -251,6 +272,8 @@ def config(defaults=None):
|
||||
help=_('Disable sharpening.'))
|
||||
c.add_opt('landscape', ['-l', '--landscape'], default=False,
|
||||
help=_("Don't split landscape images into two portrait images"))
|
||||
c.add_opt('wide', ['-w', '--wide-aspect'], default=False,
|
||||
help=_("Keep aspect ratio and scale image using screen height as image width for viewing in landscape mode."))
|
||||
c.add_opt('right2left', ['--right2left'], default=False, action='store_true',
|
||||
help=_('Used for right-to-left publications like manga. Causes landscape pages to be split into portrait pages from right to left.'))
|
||||
c.add_opt('despeckle', ['-d', '--despeckle'], default=False,
|
||||
|
@ -58,6 +58,7 @@ class ComicConf(QDialog, Ui_Dialog):
|
||||
self.opt_landscape.setChecked(opts.landscape)
|
||||
self.opt_no_sort.setChecked(opts.no_sort)
|
||||
self.opt_despeckle.setChecked(opts.despeckle)
|
||||
self.opt_wide.setChecked(opts.wide)
|
||||
self.opt_right2left.setChecked(opts.right2left)
|
||||
|
||||
for opt in self.config.option_set.preferences:
|
||||
|
@ -100,21 +100,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" >
|
||||
<item row="8" column="0" >
|
||||
<widget class="QCheckBox" name="opt_landscape" >
|
||||
<property name="text" >
|
||||
<string>&Landscape</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" >
|
||||
<item row="10" column="0" >
|
||||
<widget class="QCheckBox" name="opt_no_sort" >
|
||||
<property name="text" >
|
||||
<string>Don't so&rt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" >
|
||||
<item row="12" column="1" >
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -124,20 +124,27 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" >
|
||||
<item row="9" column="0" >
|
||||
<widget class="QCheckBox" name="opt_right2left" >
|
||||
<property name="text" >
|
||||
<string>&Right to left</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" >
|
||||
<item row="11" column="0" >
|
||||
<widget class="QCheckBox" name="opt_despeckle" >
|
||||
<property name="text" >
|
||||
<string>De&speckle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" >
|
||||
<widget class="QCheckBox" name="opt_wide" >
|
||||
<property name="text" >
|
||||
<string>&Wide</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user