Implement #1996 (Trimming option in cbr conversion)

This commit is contained in:
Kovid Goyal 2009-03-09 09:01:27 -07:00
parent 4df17ef032
commit 39452cf714
2 changed files with 81 additions and 69 deletions

View File

@ -143,6 +143,7 @@ class PageProcessor(list):
MagickRotateImage(wand, pw, -90) MagickRotateImage(wand, pw, -90)
# 25 percent fuzzy trim? # 25 percent fuzzy trim?
if not self.opts.disable_trim:
MagickTrimImage(wand, 25*65535/100) MagickTrimImage(wand, 25*65535/100)
MagickSetImagePage(wand, 0,0,0,0) #Clear page after trim, like a "+repage" MagickSetImagePage(wand, 0,0,0,0) #Clear page after trim, like a "+repage"
# Do the Photoshop "Auto Levels" equivalent # Do the Photoshop "Auto Levels" equivalent
@ -303,6 +304,9 @@ def config(defaults=None,output_format='lrf'):
help=_('Maintain picture aspect ratio. Default is to fill the screen.')) help=_('Maintain picture aspect ratio. Default is to fill the screen.'))
c.add_opt('dont_sharpen', ['-s', '--disable-sharpen'], default=False, c.add_opt('dont_sharpen', ['-s', '--disable-sharpen'], default=False,
help=_('Disable sharpening.')) help=_('Disable sharpening.'))
c.add_opt('disable_trim', ['--disable-trim'], default=False,
help=_('Disable trimming of comic pages. For some comics, '
'trimming might remove content as well as borders.'))
c.add_opt('landscape', ['-l', '--landscape'], default=False, c.add_opt('landscape', ['-l', '--landscape'], default=False,
help=_("Don't split landscape images into two portrait images")) help=_("Don't split landscape images into two portrait images"))
c.add_opt('wide', ['-w', '--wide-aspect'], default=False, c.add_opt('wide', ['-w', '--wide-aspect'], default=False,

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>Dialog</class> <class>Dialog</class>
<widget class="QDialog" name="Dialog"> <widget class="QDialog" name="Dialog">
@ -6,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>646</width> <width>646</width>
<height>468</height> <height>503</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -100,21 +101,21 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0" > <item row="9" column="0">
<widget class="QCheckBox" name="opt_landscape"> <widget class="QCheckBox" name="opt_landscape">
<property name="text"> <property name="text">
<string>&amp;Landscape</string> <string>&amp;Landscape</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="0" > <item row="11" 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&amp;rt</string> <string>Don't so&amp;rt</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="1" > <item row="13" column="1">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -124,27 +125,34 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0" > <item row="10" column="0">
<widget class="QCheckBox" name="opt_right2left"> <widget class="QCheckBox" name="opt_right2left">
<property name="text"> <property name="text">
<string>&amp;Right to left</string> <string>&amp;Right to left</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="0" > <item row="12" column="0">
<widget class="QCheckBox" name="opt_despeckle"> <widget class="QCheckBox" name="opt_despeckle">
<property name="text"> <property name="text">
<string>De&amp;speckle</string> <string>De&amp;speckle</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0" > <item row="8" column="0">
<widget class="QCheckBox" name="opt_wide"> <widget class="QCheckBox" name="opt_wide">
<property name="text"> <property name="text">
<string>&amp;Wide</string> <string>&amp;Wide</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0">
<widget class="QCheckBox" name="opt_disable_trim">
<property name="text">
<string>Disable &amp;Trimming</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources> <resources>