mirror of
https://github.com/ciromattia/kcc
synced 2026-10-12 20:42:31 +00:00
Merge master into python3
This commit is contained in:
+2
-8
@@ -416,7 +416,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Disable page spliting.<br/>They will be rotated instead.</p></body></html></string>
|
<string><html><head/><body><p>Disable splitting of two-page spreads.<br/>They will be rotated instead.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Horizontal mode</string>
|
<string>Horizontal mode</string>
|
||||||
@@ -543,9 +543,6 @@ p, li { white-space: pre-wrap; }
|
|||||||
<family>DejaVu Sans</family>
|
<family>DejaVu Sans</family>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>When converting color images setting this option to 1.0 <span style=" font-weight:600;">might</span> improve readability.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Gamma: Auto</string>
|
<string>Gamma: Auto</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -567,9 +564,6 @@ p, li { white-space: pre-wrap; }
|
|||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
<enum>Qt::ClickFocus</enum>
|
<enum>Qt::ClickFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>When converting color images setting this option to 1.0 <span style=" font-weight:600;">might</span> improve readability.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>500</number>
|
<number>500</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -641,7 +635,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Do not convert images to grayscale.</string>
|
<string><html><head/><body><p>Don't convert images to grayscale.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Color mode</string>
|
<string>Color mode</string>
|
||||||
|
|||||||
+2
-8
@@ -416,7 +416,7 @@
|
|||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p><span style=" font-size:12pt;">Disable page spliting.<br/>They will be rotated instead.</span></p></body></html></string>
|
<string><html><head/><body><p><span style=" font-size:12pt;">Disable splitting of two-page spreads.<br/>They will be rotated instead.</span></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Horizontal mode</string>
|
<string>Horizontal mode</string>
|
||||||
@@ -543,9 +543,6 @@
|
|||||||
<bold>false</bold>
|
<bold>false</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p><span style=" font-size:12pt;">When converting color images setting this option to 1.0 </span><span style=" font-size:12pt; font-weight:600;">might</span><span style=" font-size:12pt;"> improve readability.</span></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Gamma: Auto</string>
|
<string>Gamma: Auto</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -567,9 +564,6 @@
|
|||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
<enum>Qt::ClickFocus</enum>
|
<enum>Qt::ClickFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p><span style=" font-size:12pt;">When converting color images setting this option to 1.0 </span><span style=" font-size:12pt; font-weight:600;">might</span><span style=" font-size:12pt;"> improve readability.</span></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>500</number>
|
<number>500</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -645,7 +639,7 @@
|
|||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p><span style=" font-size:12pt;">Do not convert images to grayscale.</span></p></body></html></string>
|
<string><html><head/><body><p><span style=" font-size:12pt;">Don't convert images to grayscale.</span></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Color mode</string>
|
<string>Color mode</string>
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Disable page spliting.<br/>They will be rotated instead.</p></body></html></string>
|
<string><html><head/><body><p>Disable splitting of two-page spreads.<br/>They will be rotated instead.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Horizontal mode</string>
|
<string>Horizontal mode</string>
|
||||||
@@ -469,9 +469,6 @@ p, li { white-space: pre-wrap; }
|
|||||||
<height>40</height>
|
<height>40</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string>When converting color images setting this option to 1.0 MIGHT improve readability.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Gamma: Auto</string>
|
<string>Gamma: Auto</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -488,9 +485,6 @@ p, li { white-space: pre-wrap; }
|
|||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
<enum>Qt::ClickFocus</enum>
|
<enum>Qt::ClickFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>When converting color images setting this option to 1.0 <span style=" font-weight:600;">might</span> improve readability.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>500</number>
|
<number>500</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -555,7 +549,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Do not convert images to grayscale.</string>
|
<string><html><head/><body><p>Don't convert images to grayscale.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Color mode</string>
|
<string>Color mode</string>
|
||||||
|
|||||||
@@ -10,22 +10,21 @@ It can also optionally optimize images by applying a number of transformations.
|
|||||||
Amazon's tool is for comic publishers and involves a lot of manual effort, while **KCC** is for comic readers.
|
Amazon's tool is for comic publishers and involves a lot of manual effort, while **KCC** is for comic readers.
|
||||||
_KC2_ in no way is a replacement for **KCC** so you can be quite confident we'll going to carry on developing our little monster ;-)
|
_KC2_ in no way is a replacement for **KCC** so you can be quite confident we'll going to carry on developing our little monster ;-)
|
||||||
|
|
||||||
### Donations
|
### Issues / new features / donations
|
||||||
If you find **KCC** valuable you can consider donating to the authors:
|
If you have some problems using KCC please [file an issue here](https://github.com/ciromattia/kcc/issues/new).
|
||||||
|
If you can fix an open issue, fork & make a pull request.
|
||||||
|
If you want more chances an issue is fixes or your wanted feature added, consider [placing a bounty](https://www.bountysource.com/trackers/65571-ciromattia-kcc)!
|
||||||
|
|
||||||
* Ciro Mattia Gonano
|
If you find **KCC** valuable you can consider donating to the authors:
|
||||||
* PayPal: [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D8WNYNPBGDAS2)
|
* Ciro Mattia Gonano: [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D8WNYNPBGDAS2) [](http://flattr.com/thing/2260449/ciromattiakcc-on-GitHub)
|
||||||
* Flattr: [](http://flattr.com/thing/2260449/ciromattiakcc-on-GitHub)
|
* Paweł Jastrzębski: [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YTTJ4LK2JDHPS) [](bitcoin:1W15wwqsfd7wbaZ6wvSJf1LW1bz6q5L8b?label=KCC) [1W15wwqsfd7wbaZ6wvSJf1LW1bz6q5L8b](bitcoin:1W15wwqsfd7wbaZ6wvSJf1LW1bz6q5L8b?label=KCC)
|
||||||
* Paweł Jastrzębski
|
|
||||||
* PayPal: [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YTTJ4LK2JDHPS)
|
|
||||||
* BitCoin: [1W15wwqsfd7wbaZ6wvSJf1LW1bz6q5L8b](bitcoin:1W15wwqsfd7wbaZ6wvSJf1LW1bz6q5L8b?label=KCC)
|
|
||||||
|
|
||||||
## BINARY RELEASES
|
## BINARY RELEASES
|
||||||
You can find the latest released binary at the following links:
|
You can find the latest released binary at the following links:
|
||||||
- **Windows:** [http://kcc.vulturis.eu/Windows/](http://kcc.vulturis.eu/Windows/)
|
- **Windows:** [http://kcc.vulturis.eu/Windows/](http://kcc.vulturis.eu/Windows/)
|
||||||
- **Linux:** [http://kcc.vulturis.eu/Linux/](http://kcc.vulturis.eu/Linux/)
|
- **Linux:** [http://kcc.vulturis.eu/Linux/](http://kcc.vulturis.eu/Linux/)
|
||||||
- **OS X (10.8 or later):** [http://kcc.vulturis.eu/OSX/](http://kcc.vulturis.eu/OSX/)
|
- **OS X (10.8 or later):** [http://kcc.vulturis.eu/OSX/](http://kcc.vulturis.eu/OSX/)
|
||||||
- **OS X (10.7 or earlier):** [http://kcc.vulturis.eu/Old/OSX/KindleComicConverter_3.6-rc1_osx10.7.zip](http://kcc.vulturis.eu/Old/OSX/KindleComicConverter_3.6-rc1_osx10.7.zip)
|
- **OS X (10.7 or earlier):** Soon™
|
||||||
|
|
||||||
## INPUT FORMATS
|
## INPUT FORMATS
|
||||||
**KCC** can understand and convert, at the moment, the following file types:
|
**KCC** can understand and convert, at the moment, the following file types:
|
||||||
@@ -55,10 +54,10 @@ You can find the latest released binary at the following links:
|
|||||||
* Read tooltip of _High/Ultra quality_ option. There are many important informations there.
|
* Read tooltip of _High/Ultra quality_ option. There are many important informations there.
|
||||||
* When converting images smaller than device resolution remember to enable upscaling.
|
* When converting images smaller than device resolution remember to enable upscaling.
|
||||||
* Panel View (auto zooming every part of page) can be disabled directly on Kindle. There is no KCC option to do that.
|
* Panel View (auto zooming every part of page) can be disabled directly on Kindle. There is no KCC option to do that.
|
||||||
* If you're converting color images and the end result is not satisfactory, experiment with gamma correction option (check 1.0 setting first).
|
|
||||||
* Check our [wiki](https://github.com/ciromattia/kcc/wiki/Other-devices) for a list of tested Non-Kindle E-Readers.
|
* Check our [wiki](https://github.com/ciromattia/kcc/wiki/Other-devices) for a list of tested Non-Kindle E-Readers.
|
||||||
* The first image found will be set as the comic's cover.
|
* The first image found will be set as the comic's cover.
|
||||||
* All files/directories will be added to EPUB in alphabetical order.
|
* All files/directories will be added to EPUB in alphabetical order.
|
||||||
|
* Using high/ultra quality output option with Kindle Fire HD/HDX in most cases is just waste of space.
|
||||||
* ComicRack metadata will be parsed only if they are saved in *ComicInfo.xml* file.
|
* ComicRack metadata will be parsed only if they are saved in *ComicInfo.xml* file.
|
||||||
|
|
||||||
### Calibre:
|
### Calibre:
|
||||||
@@ -295,6 +294,22 @@ The app relies and includes the following scripts/binaries:
|
|||||||
* GUI tweaks and minor bug fixes
|
* GUI tweaks and minor bug fixes
|
||||||
|
|
||||||
####3.6:
|
####3.6:
|
||||||
|
* Increased quality of Panel View zoom
|
||||||
|
* Creation of multipart MOBI output is now faster on machines with 4GB+ RAM
|
||||||
|
* Automatic gamma correction now distinguishes color and grayscale images
|
||||||
|
* Added ComicRack metadata parser
|
||||||
|
* Implemented new method to detect border color in non-webtoon comics
|
||||||
|
* Upscaling is now enabled by default for Kindle Fire HD/HDX
|
||||||
|
* Windows nad Linux releases now have tray icon
|
||||||
|
* Fixed Kindle Fire HDX 7" output
|
||||||
|
* Increased target resolution for Kindle DX/DXG CBZ output
|
||||||
|
|
||||||
|
####3.6.1:
|
||||||
|
* Fixed PNG output
|
||||||
|
|
||||||
|
####3.6.2:
|
||||||
|
* Fixed previous PNG output fix
|
||||||
|
* Fixed Panel View anomalies
|
||||||
|
|
||||||
## COPYRIGHT
|
## COPYRIGHT
|
||||||
|
|
||||||
|
|||||||
+14
-9
@@ -291,7 +291,7 @@ class KindleUnpackThread(QtCore.QRunnable):
|
|||||||
try:
|
try:
|
||||||
# MOBI file produced by KindleGen is hybrid. KF8 + M7 + Source header
|
# MOBI file produced by KindleGen is hybrid. KF8 + M7 + Source header
|
||||||
# KindleSplit is removing redundant data as we need only KF8 part for new Kindle models
|
# KindleSplit is removing redundant data as we need only KF8 part for new Kindle models
|
||||||
if profile in ['K345', 'KHD', 'KF', 'KFHD', 'KFHD8', 'KFHDX8', 'KFA']:
|
if profile in ['K345', 'KHD', 'KF', 'KFHD', 'KFHD8', 'KFHDX', 'KFHDX8', 'KFA']:
|
||||||
newKindle = True
|
newKindle = True
|
||||||
else:
|
else:
|
||||||
newKindle = False
|
newKindle = False
|
||||||
@@ -356,6 +356,9 @@ class WorkerThread(QtCore.QThread):
|
|||||||
argv.append("--quality=1")
|
argv.append("--quality=1")
|
||||||
elif GUI.QualityBox.checkState() == 2:
|
elif GUI.QualityBox.checkState() == 2:
|
||||||
argv.append("--quality=2")
|
argv.append("--quality=2")
|
||||||
|
if GUI.currentMode == 1:
|
||||||
|
if profile in ['KFHD', 'KFHD8', 'KFHDX', 'KFHDX8']:
|
||||||
|
argv.append("--upscale")
|
||||||
if GUI.currentMode > 1:
|
if GUI.currentMode > 1:
|
||||||
if GUI.ProcessingBox.isChecked():
|
if GUI.ProcessingBox.isChecked():
|
||||||
argv.append("--noprocessing")
|
argv.append("--noprocessing")
|
||||||
@@ -374,6 +377,7 @@ class WorkerThread(QtCore.QThread):
|
|||||||
if GUI.WebtoonBox.isChecked():
|
if GUI.WebtoonBox.isChecked():
|
||||||
argv.append("--webtoon")
|
argv.append("--webtoon")
|
||||||
if float(GUI.GammaValue) > 0.09:
|
if float(GUI.GammaValue) > 0.09:
|
||||||
|
# noinspection PyTypeChecker
|
||||||
argv.append("--gamma=" + GUI.GammaValue)
|
argv.append("--gamma=" + GUI.GammaValue)
|
||||||
if str(GUI.FormatBox.currentText()) == 'CBZ':
|
if str(GUI.FormatBox.currentText()) == 'CBZ':
|
||||||
argv.append("--cbz-output")
|
argv.append("--cbz-output")
|
||||||
@@ -540,11 +544,11 @@ class WorkerThread(QtCore.QThread):
|
|||||||
class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
if not sys.platform.startswith('darwin') and self.isSystemTrayAvailable():
|
if not sys.platform.startswith('darwin') and self.isSystemTrayAvailable():
|
||||||
QtGui.QSystemTrayIcon.__init__(self, parent)
|
QtGui.QSystemTrayIcon.__init__(self, GUI.icons.programIcon, MW)
|
||||||
self.setIcon(GUI.icons.programIcon)
|
|
||||||
self.activated.connect(self.catchClicks)
|
self.activated.connect(self.catchClicks)
|
||||||
|
|
||||||
def catchClicks(self):
|
def catchClicks(self):
|
||||||
|
MW.showNormal()
|
||||||
MW.raise_()
|
MW.raise_()
|
||||||
MW.activateWindow()
|
MW.activateWindow()
|
||||||
|
|
||||||
@@ -793,9 +797,12 @@ class KCCGUI(KCC_ui.Ui_KCC):
|
|||||||
GUI.QualityBox.setChecked(False)
|
GUI.QualityBox.setChecked(False)
|
||||||
GUI.QualityBox.setEnabled(False)
|
GUI.QualityBox.setEnabled(False)
|
||||||
self.QualityBoxDisabled = True
|
self.QualityBoxDisabled = True
|
||||||
|
if value in [4, 5, 6, 7]:
|
||||||
|
if GUI.UpscaleBox.isEnabled():
|
||||||
|
GUI.UpscaleBox.setChecked(True)
|
||||||
else:
|
else:
|
||||||
if not GUI.WebtoonBox.isChecked() and not GUI.ProcessingBox.isChecked() \
|
if not GUI.WebtoonBox.isChecked() and not GUI.ProcessingBox.isChecked() \
|
||||||
and str(GUI.FormatBox.currentText()) != 'CBZ':
|
and str(GUI.FormatBox.currentText()) != 'CBZ' and value not in [9, 11, 12, 13]:
|
||||||
GUI.QualityBox.setEnabled(True)
|
GUI.QualityBox.setEnabled(True)
|
||||||
self.QualityBoxDisabled = False
|
self.QualityBoxDisabled = False
|
||||||
|
|
||||||
@@ -880,8 +887,6 @@ class KCCGUI(KCC_ui.Ui_KCC):
|
|||||||
event.ignore()
|
event.ignore()
|
||||||
if not GUI.ConvertButton.isEnabled():
|
if not GUI.ConvertButton.isEnabled():
|
||||||
event.ignore()
|
event.ignore()
|
||||||
if not sys.platform.startswith('darwin'):
|
|
||||||
self.tray.hide()
|
|
||||||
self.contentServer.stop()
|
self.contentServer.stop()
|
||||||
self.settings.setValue('settingsVersion', __version__)
|
self.settings.setValue('settingsVersion', __version__)
|
||||||
self.settings.setValue('lastPath', self.lastPath)
|
self.settings.setValue('lastPath', self.lastPath)
|
||||||
@@ -978,9 +983,9 @@ class KCCGUI(KCC_ui.Ui_KCC):
|
|||||||
self.tray.show()
|
self.tray.show()
|
||||||
|
|
||||||
statusBarLabel = QtGui.QLabel('<b><a href="http://kcc.vulturis.eu/">HOMEPAGE</a> - <a href="https://github.com/'
|
statusBarLabel = QtGui.QLabel('<b><a href="http://kcc.vulturis.eu/">HOMEPAGE</a> - <a href="https://github.com/'
|
||||||
'ciromattia/kcc/blob/master/README.md#donations">DONATE</a> - <a href="https://gi'
|
'ciromattia/kcc/blob/master/README.md#issues--new-features--donations">DONATE</a>'
|
||||||
'thub.com/ciromattia/kcc/blob/master/README.md#kcc">README</a> - <a href="https:/'
|
' - <a href="https://github.com/ciromattia/kcc/blob/master/README.md#kcc">README<'
|
||||||
'/github.com/ciromattia/kcc/wiki">WIKI</a></b>')
|
'/a> - <a href="https://github.com/ciromattia/kcc/wiki">WIKI</a></b>')
|
||||||
statusBarLabel.setAlignment(QtCore.Qt.AlignCenter)
|
statusBarLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
statusBarLabel.setStyleSheet(self.statusBarStyle)
|
statusBarLabel.setStyleSheet(self.statusBarStyle)
|
||||||
statusBarLabel.setOpenExternalLinks(True)
|
statusBarLabel.setOpenExternalLinks(True)
|
||||||
|
|||||||
+3
-5
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'KCC.ui'
|
# Form implementation generated from reading ui file 'KCC.ui'
|
||||||
#
|
#
|
||||||
# Created: Tue Nov 12 14:31:48 2013
|
# Created: Fri Dec 13 19:22:05 2013
|
||||||
# by: PyQt4 UI code generator 4.10.3
|
# by: PyQt4 UI code generator 4.10.3
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
@@ -301,14 +301,12 @@ class Ui_KCC(object):
|
|||||||
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; text-decoration: underline;\">Indeterminate - High quality mode<br /></span><span style=\" font-style:italic;\">Not zoomed image </span><span style=\" font-weight:600; font-style:italic;\">might </span><span style=\" font-style:italic;\">be </span><span style=\" font-style:italic;\">a little blurry.</span><span style=\" font-weight:600; text-decoration: underline;\"><br /></span>- Medium/High quality when zoom is not enabled.<br />- Maximum quality when zoom is enabled.</p>\n"
|
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; text-decoration: underline;\">Indeterminate - High quality mode<br /></span><span style=\" font-style:italic;\">Not zoomed image </span><span style=\" font-weight:600; font-style:italic;\">might </span><span style=\" font-style:italic;\">be </span><span style=\" font-style:italic;\">a little blurry.</span><span style=\" font-weight:600; text-decoration: underline;\"><br /></span>- Medium/High quality when zoom is not enabled.<br />- Maximum quality when zoom is enabled.</p>\n"
|
||||||
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; text-decoration: underline;\">Checked - Ultra quality mode<br /></span><span style=\" font-style:italic;\">Maximum possible quality.</span><span style=\" font-weight:600; text-decoration: underline;\"><br /></span>- Maximum quality when zoom is not enabled.<br />- Maximum quality when zoom is enabled.<br />- Very high file size.</p></body></html>", None))
|
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; text-decoration: underline;\">Checked - Ultra quality mode<br /></span><span style=\" font-style:italic;\">Maximum possible quality.</span><span style=\" font-weight:600; text-decoration: underline;\"><br /></span>- Maximum quality when zoom is not enabled.<br />- Maximum quality when zoom is enabled.<br />- Very high file size.</p></body></html>", None))
|
||||||
self.QualityBox.setText(_translate("KCC", "High/Ultra quality", None))
|
self.QualityBox.setText(_translate("KCC", "High/Ultra quality", None))
|
||||||
self.RotateBox.setToolTip(_translate("KCC", "<html><head/><body><p>Disable page spliting.<br/>They will be rotated instead.</p></body></html>", None))
|
self.RotateBox.setToolTip(_translate("KCC", "<html><head/><body><p>Disable splitting of two-page spreads.<br/>They will be rotated instead.</p></body></html>", None))
|
||||||
self.RotateBox.setText(_translate("KCC", "Horizontal mode", None))
|
self.RotateBox.setText(_translate("KCC", "Horizontal mode", None))
|
||||||
self.BasicModeButton.setText(_translate("KCC", "Basic", None))
|
self.BasicModeButton.setText(_translate("KCC", "Basic", None))
|
||||||
self.AdvModeButton.setText(_translate("KCC", "Advanced", None))
|
self.AdvModeButton.setText(_translate("KCC", "Advanced", None))
|
||||||
self.GammaLabel.setToolTip(_translate("KCC", "When converting color images setting this option to 1.0 MIGHT improve readability.", None))
|
|
||||||
self.GammaLabel.setText(_translate("KCC", "Gamma: Auto", None))
|
self.GammaLabel.setText(_translate("KCC", "Gamma: Auto", None))
|
||||||
self.GammaSlider.setToolTip(_translate("KCC", "<html><head/><body><p>When converting color images setting this option to 1.0 <span style=\" font-weight:600;\">might</span> improve readability.</p></body></html>", None))
|
self.ColorBox.setToolTip(_translate("KCC", "<html><head/><body><p>Don\'t convert images to grayscale.</p></body></html>", None))
|
||||||
self.ColorBox.setToolTip(_translate("KCC", "Do not convert images to grayscale.", None))
|
|
||||||
self.ColorBox.setText(_translate("KCC", "Color mode", None))
|
self.ColorBox.setText(_translate("KCC", "Color mode", None))
|
||||||
self.wLabel.setToolTip(_translate("KCC", "Resolution of target device.", None))
|
self.wLabel.setToolTip(_translate("KCC", "Resolution of target device.", None))
|
||||||
self.wLabel.setText(_translate("KCC", "Custom width: ", None))
|
self.wLabel.setText(_translate("KCC", "Custom width: ", None))
|
||||||
|
|||||||
+3
-5
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'KCC-Linux.ui'
|
# Form implementation generated from reading ui file 'KCC-Linux.ui'
|
||||||
#
|
#
|
||||||
# Created: Tue Nov 12 14:32:11 2013
|
# Created: Fri Dec 13 19:22:17 2013
|
||||||
# by: PyQt4 UI code generator 4.10.3
|
# by: PyQt4 UI code generator 4.10.3
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
@@ -370,14 +370,12 @@ class Ui_KCC(object):
|
|||||||
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-weight:600; text-decoration: underline;\">Indeterminate - High quality mode<br /></span><span style=\" font-family:\'MS Shell Dlg 2\'; font-style:italic;\">Not zoomed image </span><span style=\" font-family:\'MS Shell Dlg 2\'; font-weight:600; font-style:italic;\">might </span><span style=\" font-family:\'MS Shell Dlg 2\'; font-style:italic;\">be a little blurry.</span><span style=\" font-family:\'MS Shell Dlg 2\'; font-weight:600; text-decoration: underline;\"><br /></span><span style=\" font-family:\'MS Shell Dlg 2\';\">- Medium/High quality when zoom is not enabled.<br />- Maximum quality when zoom is enabled.</span></p>\n"
|
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-weight:600; text-decoration: underline;\">Indeterminate - High quality mode<br /></span><span style=\" font-family:\'MS Shell Dlg 2\'; font-style:italic;\">Not zoomed image </span><span style=\" font-family:\'MS Shell Dlg 2\'; font-weight:600; font-style:italic;\">might </span><span style=\" font-family:\'MS Shell Dlg 2\'; font-style:italic;\">be a little blurry.</span><span style=\" font-family:\'MS Shell Dlg 2\'; font-weight:600; text-decoration: underline;\"><br /></span><span style=\" font-family:\'MS Shell Dlg 2\';\">- Medium/High quality when zoom is not enabled.<br />- Maximum quality when zoom is enabled.</span></p>\n"
|
||||||
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-weight:600; text-decoration: underline;\">Checked - Ultra quality mode<br /></span><span style=\" font-family:\'MS Shell Dlg 2\'; font-style:italic;\">Maximum possible quality.</span><span style=\" font-family:\'MS Shell Dlg 2\'; font-weight:600; text-decoration: underline;\"><br /></span><span style=\" font-family:\'MS Shell Dlg 2\';\">- Maximum quality when zoom is not enabled.<br />- Maximum quality when zoom is enabled.<br />- Very high file size.</span></p></body></html>", None))
|
"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-weight:600; text-decoration: underline;\">Checked - Ultra quality mode<br /></span><span style=\" font-family:\'MS Shell Dlg 2\'; font-style:italic;\">Maximum possible quality.</span><span style=\" font-family:\'MS Shell Dlg 2\'; font-weight:600; text-decoration: underline;\"><br /></span><span style=\" font-family:\'MS Shell Dlg 2\';\">- Maximum quality when zoom is not enabled.<br />- Maximum quality when zoom is enabled.<br />- Very high file size.</span></p></body></html>", None))
|
||||||
self.QualityBox.setText(_translate("KCC", "High/Ultra quality", None))
|
self.QualityBox.setText(_translate("KCC", "High/Ultra quality", None))
|
||||||
self.RotateBox.setToolTip(_translate("KCC", "<html><head/><body><p>Disable page spliting.<br/>They will be rotated instead.</p></body></html>", None))
|
self.RotateBox.setToolTip(_translate("KCC", "<html><head/><body><p>Disable splitting of two-page spreads.<br/>They will be rotated instead.</p></body></html>", None))
|
||||||
self.RotateBox.setText(_translate("KCC", "Horizontal mode", None))
|
self.RotateBox.setText(_translate("KCC", "Horizontal mode", None))
|
||||||
self.BasicModeButton.setText(_translate("KCC", "Basic", None))
|
self.BasicModeButton.setText(_translate("KCC", "Basic", None))
|
||||||
self.AdvModeButton.setText(_translate("KCC", "Advanced", None))
|
self.AdvModeButton.setText(_translate("KCC", "Advanced", None))
|
||||||
self.GammaLabel.setToolTip(_translate("KCC", "<html><head/><body><p>When converting color images setting this option to 1.0 <span style=\" font-weight:600;\">might</span> improve readability.</p></body></html>", None))
|
|
||||||
self.GammaLabel.setText(_translate("KCC", "Gamma: Auto", None))
|
self.GammaLabel.setText(_translate("KCC", "Gamma: Auto", None))
|
||||||
self.GammaSlider.setToolTip(_translate("KCC", "<html><head/><body><p>When converting color images setting this option to 1.0 <span style=\" font-weight:600;\">might</span> improve readability.</p></body></html>", None))
|
self.ColorBox.setToolTip(_translate("KCC", "<html><head/><body><p>Don\'t convert images to grayscale.</p></body></html>", None))
|
||||||
self.ColorBox.setToolTip(_translate("KCC", "Do not convert images to grayscale.", None))
|
|
||||||
self.ColorBox.setText(_translate("KCC", "Color mode", None))
|
self.ColorBox.setText(_translate("KCC", "Color mode", None))
|
||||||
self.wLabel.setToolTip(_translate("KCC", "Resolution of target device.", None))
|
self.wLabel.setToolTip(_translate("KCC", "Resolution of target device.", None))
|
||||||
self.wLabel.setText(_translate("KCC", "Custom width: ", None))
|
self.wLabel.setText(_translate("KCC", "Custom width: ", None))
|
||||||
|
|||||||
+3
-5
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'KCC-OSX.ui'
|
# Form implementation generated from reading ui file 'KCC-OSX.ui'
|
||||||
#
|
#
|
||||||
# Created: Tue Nov 12 14:31:59 2013
|
# Created: Fri Dec 13 19:22:27 2013
|
||||||
# by: PyQt4 UI code generator 4.10.3
|
# by: PyQt4 UI code generator 4.10.3
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
@@ -388,14 +388,12 @@ class Ui_KCC(object):
|
|||||||
self.MangaBox.setText(_translate("KCC", "Manga mode", None))
|
self.MangaBox.setText(_translate("KCC", "Manga mode", None))
|
||||||
self.QualityBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\"font-size:12pt; font-weight:600; text-decoration: underline;\">Unchecked - Normal quality mode<br/></span><span style=\"font-size:12pt; font-style:italic;\">Use it when Panel View support is not needed.</span><span style=\"font-size:12pt; font-weight:600; text-decoration: underline;\"><br/></span><span style=\"font-size:12pt;\">- Maximum quality when zoom is not enabled.<br/>- Poor quality when zoom is enabled.<br/>- Lowest file size.</span></p><p><span style=\"font-size:12pt; font-weight:600; text-decoration: underline;\">Indeterminate - High quality mode<br/></span><span style=\"font-size:12pt; font-style:italic;\">Not zoomed image </span><span style=\"font-size:12pt; font-weight:600; font-style:italic;\">might </span><span style=\"font-size:12pt; font-style:italic;\">be a little blurry.</span><span style=\"font-size:12pt; font-weight:600; text-decoration: underline;\"><br/></span><span style=\"font-size:12pt;\">- Medium/High quality when zoom is not enabled.<br/>- Maximum quality when zoom is enabled.</span></p><p><span style=\"font-size:12pt; font-weight:600; text-decoration: underline;\">Checked - Ultra quality mode<br/></span><span style=\"font-size:12pt; font-style:italic;\">Maximum possible quality.</span><span style=\"font-size:12pt; font-weight:600; text-decoration: underline;\"><br/></span><span style=\"font-size:12pt;\">- Maximum quality when zoom is not enabled.<br/>- Maximum quality when zoom is enabled.<br/>- Very high file size.</span></p></body></html>", None))
|
self.QualityBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\"font-size:12pt; font-weight:600; text-decoration: underline;\">Unchecked - Normal quality mode<br/></span><span style=\"font-size:12pt; font-style:italic;\">Use it when Panel View support is not needed.</span><span style=\"font-size:12pt; font-weight:600; text-decoration: underline;\"><br/></span><span style=\"font-size:12pt;\">- Maximum quality when zoom is not enabled.<br/>- Poor quality when zoom is enabled.<br/>- Lowest file size.</span></p><p><span style=\"font-size:12pt; font-weight:600; text-decoration: underline;\">Indeterminate - High quality mode<br/></span><span style=\"font-size:12pt; font-style:italic;\">Not zoomed image </span><span style=\"font-size:12pt; font-weight:600; font-style:italic;\">might </span><span style=\"font-size:12pt; font-style:italic;\">be a little blurry.</span><span style=\"font-size:12pt; font-weight:600; text-decoration: underline;\"><br/></span><span style=\"font-size:12pt;\">- Medium/High quality when zoom is not enabled.<br/>- Maximum quality when zoom is enabled.</span></p><p><span style=\"font-size:12pt; font-weight:600; text-decoration: underline;\">Checked - Ultra quality mode<br/></span><span style=\"font-size:12pt; font-style:italic;\">Maximum possible quality.</span><span style=\"font-size:12pt; font-weight:600; text-decoration: underline;\"><br/></span><span style=\"font-size:12pt;\">- Maximum quality when zoom is not enabled.<br/>- Maximum quality when zoom is enabled.<br/>- Very high file size.</span></p></body></html>", None))
|
||||||
self.QualityBox.setText(_translate("KCC", "High/Ultra quality", None))
|
self.QualityBox.setText(_translate("KCC", "High/Ultra quality", None))
|
||||||
self.RotateBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-size:12pt;\">Disable page spliting.<br/>They will be rotated instead.</span></p></body></html>", None))
|
self.RotateBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-size:12pt;\">Disable splitting of two-page spreads.<br/>They will be rotated instead.</span></p></body></html>", None))
|
||||||
self.RotateBox.setText(_translate("KCC", "Horizontal mode", None))
|
self.RotateBox.setText(_translate("KCC", "Horizontal mode", None))
|
||||||
self.BasicModeButton.setText(_translate("KCC", "Basic", None))
|
self.BasicModeButton.setText(_translate("KCC", "Basic", None))
|
||||||
self.AdvModeButton.setText(_translate("KCC", "Advanced", None))
|
self.AdvModeButton.setText(_translate("KCC", "Advanced", None))
|
||||||
self.GammaLabel.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-size:12pt;\">When converting color images setting this option to 1.0 </span><span style=\" font-size:12pt; font-weight:600;\">might</span><span style=\" font-size:12pt;\"> improve readability.</span></p></body></html>", None))
|
|
||||||
self.GammaLabel.setText(_translate("KCC", "Gamma: Auto", None))
|
self.GammaLabel.setText(_translate("KCC", "Gamma: Auto", None))
|
||||||
self.GammaSlider.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-size:12pt;\">When converting color images setting this option to 1.0 </span><span style=\" font-size:12pt; font-weight:600;\">might</span><span style=\" font-size:12pt;\"> improve readability.</span></p></body></html>", None))
|
self.ColorBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-size:12pt;\">Don\'t convert images to grayscale.</span></p></body></html>", None))
|
||||||
self.ColorBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-size:12pt;\">Do not convert images to grayscale.</span></p></body></html>", None))
|
|
||||||
self.ColorBox.setText(_translate("KCC", "Color mode", None))
|
self.ColorBox.setText(_translate("KCC", "Color mode", None))
|
||||||
self.wLabel.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-size:12pt;\">Resolution of target device.</span></p></body></html>", None))
|
self.wLabel.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-size:12pt;\">Resolution of target device.</span></p></body></html>", None))
|
||||||
self.wLabel.setText(_translate("KCC", "Custom width: ", None))
|
self.wLabel.setText(_translate("KCC", "Custom width: ", None))
|
||||||
|
|||||||
+13
-1
@@ -23,8 +23,20 @@ import os
|
|||||||
import zipfile
|
import zipfile
|
||||||
from . import rarfile
|
from . import rarfile
|
||||||
import locale
|
import locale
|
||||||
|
from sys import platform
|
||||||
from subprocess import STDOUT, PIPE
|
from subprocess import STDOUT, PIPE
|
||||||
from psutil import Popen
|
try:
|
||||||
|
#noinspection PyUnresolvedReferences
|
||||||
|
from psutil import Popen
|
||||||
|
except ImportError:
|
||||||
|
print("ERROR: Psutil is not installed!")
|
||||||
|
if platform.startswith('linux'):
|
||||||
|
import Tkinter
|
||||||
|
import tkMessageBox
|
||||||
|
importRoot = Tkinter.Tk()
|
||||||
|
importRoot.withdraw()
|
||||||
|
tkMessageBox.showerror("KCC - Error", "Psutil is not installed!")
|
||||||
|
exit(1)
|
||||||
from shutil import move
|
from shutil import move
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+55
-35
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python2
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright (c) 2012-2013 Ciro Mattia Gonano <ciromattia@gmail.com>
|
# Copyright (c) 2012-2013 Ciro Mattia Gonano <ciromattia@gmail.com>
|
||||||
@@ -106,9 +106,9 @@ def buildHTML(path, imgfile):
|
|||||||
elif noHorizontalPV and not noVerticalPV:
|
elif noHorizontalPV and not noVerticalPV:
|
||||||
if rotatedPage:
|
if rotatedPage:
|
||||||
if options.righttoleft:
|
if options.righttoleft:
|
||||||
order = [2, 1]
|
|
||||||
else:
|
|
||||||
order = [1, 2]
|
order = [1, 2]
|
||||||
|
else:
|
||||||
|
order = [2, 1]
|
||||||
else:
|
else:
|
||||||
order = [1, 2]
|
order = [1, 2]
|
||||||
boxes = ["BoxT", "BoxB"]
|
boxes = ["BoxT", "BoxB"]
|
||||||
@@ -130,35 +130,48 @@ def buildHTML(path, imgfile):
|
|||||||
"}'></a></div>\n"])
|
"}'></a></div>\n"])
|
||||||
if options.quality == 2:
|
if options.quality == 2:
|
||||||
imgfilepv = string.split(imgfile, ".")
|
imgfilepv = string.split(imgfile, ".")
|
||||||
imgfilepv[0] = imgfilepv[0].split("_kccx")[0].replace("_kccnh", "").replace("_kccnv", "")
|
imgfilepv[0] = imgfilepv[0].split("_kccxl")[0].replace("_kccnh", "").replace("_kccnv", "")
|
||||||
imgfilepv[0] += "_kcchq"
|
imgfilepv[0] += "_kcchq"
|
||||||
imgfilepv = string.join(imgfilepv, ".")
|
imgfilepv = string.join(imgfilepv, ".")
|
||||||
else:
|
else:
|
||||||
imgfilepv = imgfile
|
imgfilepv = imgfile
|
||||||
if "_kccx" in filename[0]:
|
if "_kccxl" in filename[0]:
|
||||||
xy = string.split(filename[0], "_kccx")[1]
|
borders = filename[0].split('_kccxl')[1]
|
||||||
x = string.split(xy, "_kccy")[0].lstrip("0")
|
borders = re.findall('[0-9]{1,6}', borders)
|
||||||
y = string.split(xy, "_kccy")[1].lstrip("0")
|
xl = borders[0].lstrip("0")
|
||||||
if x != "":
|
yu = borders[1].lstrip("0")
|
||||||
x = "-" + str(float(x)/100) + "%"
|
xr = borders[2].lstrip("0")
|
||||||
|
yd = borders[3].lstrip("0")
|
||||||
|
if xl != "":
|
||||||
|
xl = "-" + str(float(xl)/100) + "%"
|
||||||
else:
|
else:
|
||||||
x = "0%"
|
xl = "0%"
|
||||||
if y != "":
|
if xr != "":
|
||||||
y = "-" + str(float(y)/100) + "%"
|
xr = "-" + str(float(xr)/100) + "%"
|
||||||
else:
|
else:
|
||||||
y = "0%"
|
xr = "0%"
|
||||||
|
if yu != "":
|
||||||
|
yu = "-" + str(float(yu)/100) + "%"
|
||||||
|
else:
|
||||||
|
yu = "0%"
|
||||||
|
if yd != "":
|
||||||
|
yd = "-" + str(float(yd)/100) + "%"
|
||||||
|
else:
|
||||||
|
yd = "0%"
|
||||||
else:
|
else:
|
||||||
x = "0%"
|
xl = "0%"
|
||||||
y = "0%"
|
yu = "0%"
|
||||||
boxStyles = {"BoxTL": "left:" + x + ";top:" + y + ";",
|
xr = "0%"
|
||||||
"BoxTR": "right:" + x + ";top:" + y + ";",
|
yd = "0%"
|
||||||
"BoxBL": "left:" + x + ";bottom:" + y + ";",
|
boxStyles = {"BoxTL": "left:" + xl + ";top:" + yu + ";",
|
||||||
"BoxBR": "right:" + x + ";bottom:" + y + ";",
|
"BoxTR": "right:" + xr + ";top:" + yu + ";",
|
||||||
"BoxT": "left:-25%;top:" + y + ";",
|
"BoxBL": "left:" + xl + ";bottom:" + yd + ";",
|
||||||
"BoxB": "left:-25%;bottom:" + y + ";",
|
"BoxBR": "right:" + xr + ";bottom:" + yd + ";",
|
||||||
"BoxL": "left:" + x + ";top:-25%;",
|
"BoxT": "left:-25%;top:" + yu + ";",
|
||||||
"BoxR": "right:" + x + ";top:-25%;",
|
"BoxB": "left:-25%;bottom:" + yd + ";",
|
||||||
"BoxC": "right:-25%;top:-25%;"
|
"BoxL": "left:" + xl + ";top:-25%;",
|
||||||
|
"BoxR": "right:" + xr + ";top:-25%;",
|
||||||
|
"BoxC": "left:-25%;top:-25%;"
|
||||||
}
|
}
|
||||||
for box in boxes:
|
for box in boxes:
|
||||||
f.writelines(["<div id=\"" + box + "-Panel-Parent\" class=\"target-mag-parent\"><div id=\"",
|
f.writelines(["<div id=\"" + box + "-Panel-Parent\" class=\"target-mag-parent\"><div id=\"",
|
||||||
@@ -173,6 +186,7 @@ def buildHTML(path, imgfile):
|
|||||||
|
|
||||||
def buildNCX(dstdir, title, chapters):
|
def buildNCX(dstdir, title, chapters):
|
||||||
options.uuid = str(uuid4())
|
options.uuid = str(uuid4())
|
||||||
|
options.uuid = options.uuid.encode('utf-8')
|
||||||
ncxfile = os.path.join(dstdir, 'OEBPS', 'toc.ncx')
|
ncxfile = os.path.join(dstdir, 'OEBPS', 'toc.ncx')
|
||||||
f = open(ncxfile, "w")
|
f = open(ncxfile, "w")
|
||||||
f.writelines(["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
|
f.writelines(["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
|
||||||
@@ -295,7 +309,7 @@ def getImageFileName(imgfile):
|
|||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
|
||||||
def applyImgOptimization(img, opt, overrideQuality=5):
|
def applyImgOptimization(img, opt, hqImage=None):
|
||||||
if not img.fill:
|
if not img.fill:
|
||||||
img.getImageFill(opt.webtoon)
|
img.getImageFill(opt.webtoon)
|
||||||
if not opt.webtoon:
|
if not opt.webtoon:
|
||||||
@@ -303,10 +317,16 @@ def applyImgOptimization(img, opt, overrideQuality=5):
|
|||||||
if opt.cutpagenumbers and not opt.webtoon:
|
if opt.cutpagenumbers and not opt.webtoon:
|
||||||
img.cutPageNumber()
|
img.cutPageNumber()
|
||||||
img.optimizeImage(opt.gamma)
|
img.optimizeImage(opt.gamma)
|
||||||
if overrideQuality != 5:
|
if hqImage:
|
||||||
img.resizeImage(opt.upscale, opt.stretch, opt.bordersColor, overrideQuality)
|
img.resizeImage(opt.upscale, opt.stretch, opt.bordersColor, 0)
|
||||||
|
img.calculateBorder(hqImage, True)
|
||||||
else:
|
else:
|
||||||
img.resizeImage(opt.upscale, opt.stretch, opt.bordersColor, opt.quality)
|
img.resizeImage(opt.upscale, opt.stretch, opt.bordersColor, opt.quality)
|
||||||
|
if opt.panelview:
|
||||||
|
if opt.quality == 0:
|
||||||
|
img.calculateBorder(img)
|
||||||
|
elif opt.quality == 1:
|
||||||
|
img.calculateBorder(img, True)
|
||||||
if opt.forcepng and not opt.forcecolor:
|
if opt.forcepng and not opt.forcecolor:
|
||||||
img.quantizeImage()
|
img.quantizeImage()
|
||||||
|
|
||||||
@@ -378,12 +398,12 @@ def fileImgProcess(work):
|
|||||||
applyImgOptimization(img1, opt)
|
applyImgOptimization(img1, opt)
|
||||||
img1.saveToDir(dirpath, opt.forcepng, opt.forcecolor, wipe)
|
img1.saveToDir(dirpath, opt.forcepng, opt.forcecolor, wipe)
|
||||||
if opt.quality == 2:
|
if opt.quality == 2:
|
||||||
img3 = image.ComicPage(split[0], opt.profileData, img0.fill)
|
img0b = image.ComicPage(split[0], opt.profileData, img0.fill)
|
||||||
applyImgOptimization(img3, opt, 0)
|
applyImgOptimization(img0b, opt, img0)
|
||||||
img3.saveToDir(dirpath, opt.forcepng, opt.forcecolor, True)
|
img0b.saveToDir(dirpath, opt.forcepng, opt.forcecolor, True)
|
||||||
img4 = image.ComicPage(split[1], opt.profileData, img1.fill)
|
img1b = image.ComicPage(split[1], opt.profileData, img1.fill)
|
||||||
applyImgOptimization(img4, opt, 0)
|
applyImgOptimization(img1b, opt, img1)
|
||||||
img4.saveToDir(dirpath, opt.forcepng, opt.forcecolor, True)
|
img1b.saveToDir(dirpath, opt.forcepng, opt.forcecolor, True)
|
||||||
else:
|
else:
|
||||||
applyImgOptimization(img, opt)
|
applyImgOptimization(img, opt)
|
||||||
img.saveToDir(dirpath, opt.forcepng, opt.forcecolor, wipe)
|
img.saveToDir(dirpath, opt.forcepng, opt.forcecolor, wipe)
|
||||||
@@ -392,7 +412,7 @@ def fileImgProcess(work):
|
|||||||
if img.rotated:
|
if img.rotated:
|
||||||
img2.image = img2.image.rotate(90)
|
img2.image = img2.image.rotate(90)
|
||||||
img2.rotated = True
|
img2.rotated = True
|
||||||
applyImgOptimization(img2, opt, 0)
|
applyImgOptimization(img2, opt, img)
|
||||||
img2.saveToDir(dirpath, opt.forcepng, opt.forcecolor, True)
|
img2.saveToDir(dirpath, opt.forcepng, opt.forcecolor, True)
|
||||||
except Exception:
|
except Exception:
|
||||||
import traceback
|
import traceback
|
||||||
|
|||||||
+78
-59
@@ -201,7 +201,8 @@ class ComicPage:
|
|||||||
if self.noVPV:
|
if self.noVPV:
|
||||||
suffix += "_kccnv"
|
suffix += "_kccnv"
|
||||||
if self.border:
|
if self.border:
|
||||||
suffix += "_kccx" + str(self.border[0]) + "_kccy" + str(self.border[1])
|
suffix += "_kccxl" + str(self.border[0]) + "_kccyu" + str(self.border[1]) + "_kccxr" +\
|
||||||
|
str(self.border[2]) + "_kccyd" + str(self.border[3])
|
||||||
if forcepng:
|
if forcepng:
|
||||||
self.image.save(os.path.join(targetdir, os.path.splitext(self.filename)[0] + suffix + ".png"), "PNG",
|
self.image.save(os.path.join(targetdir, os.path.splitext(self.filename)[0] + suffix + ".png"), "PNG",
|
||||||
optimize=1)
|
optimize=1)
|
||||||
@@ -214,6 +215,8 @@ class ComicPage:
|
|||||||
def optimizeImage(self, gamma):
|
def optimizeImage(self, gamma):
|
||||||
if gamma < 0.1:
|
if gamma < 0.1:
|
||||||
gamma = self.gamma
|
gamma = self.gamma
|
||||||
|
if self.gamma != 1.0 and self.isImageColor(self.image):
|
||||||
|
gamma = 1.0
|
||||||
if gamma == 1.0:
|
if gamma == 1.0:
|
||||||
self.image = ImageOps.autocontrast(self.image)
|
self.image = ImageOps.autocontrast(self.image)
|
||||||
else:
|
else:
|
||||||
@@ -230,58 +233,61 @@ class ComicPage:
|
|||||||
# Quantize is deprecated but new function call it internally anyway...
|
# Quantize is deprecated but new function call it internally anyway...
|
||||||
self.image = self.image.quantize(palette=palImg)
|
self.image = self.image.quantize(palette=palImg)
|
||||||
|
|
||||||
|
def calculateBorderPercent(self, x, img, isWidth):
|
||||||
|
if isWidth:
|
||||||
|
return int(round(float(x)/float(img.image.size[0]), 4) * 10000 * 1.5)
|
||||||
|
else:
|
||||||
|
return int(round(float(x)/float(img.image.size[1]), 4) * 10000 * 1.5)
|
||||||
|
|
||||||
|
def calculateBorder(self, sourceImage, isHQ=False):
|
||||||
|
if self.fill == 'white':
|
||||||
|
# This code trigger only when sourceImage is already saved. So we can break color quantization.
|
||||||
|
if sourceImage.image.mode == 'P':
|
||||||
|
sourceImage.image = sourceImage.image.convert('RGB')
|
||||||
|
border = ImageChops.invert(sourceImage.image).getbbox()
|
||||||
|
else:
|
||||||
|
border = sourceImage.image.getbbox()
|
||||||
|
if border is not None:
|
||||||
|
if isHQ:
|
||||||
|
multiplier = 1.0
|
||||||
|
else:
|
||||||
|
multiplier = 1.5
|
||||||
|
self.border = [self.calculateBorderPercent(border[0], sourceImage, True),
|
||||||
|
self.calculateBorderPercent(border[1], sourceImage, False),
|
||||||
|
self.calculateBorderPercent((sourceImage.image.size[0] - border[2]), sourceImage, True),
|
||||||
|
self.calculateBorderPercent((sourceImage.image.size[1] - border[3]), sourceImage, False)]
|
||||||
|
if int((border[2] - border[0]) * multiplier) < self.size[0]:
|
||||||
|
self.noHPV = True
|
||||||
|
if int((border[3] - border[1]) * multiplier) < self.size[1]:
|
||||||
|
self.noVPV = True
|
||||||
|
else:
|
||||||
|
self.border = [0, 0, 0, 0]
|
||||||
|
self.noHPV = True
|
||||||
|
self.noVPV = True
|
||||||
|
|
||||||
def resizeImage(self, upscale=False, stretch=False, bordersColor=None, qualityMode=0):
|
def resizeImage(self, upscale=False, stretch=False, bordersColor=None, qualityMode=0):
|
||||||
# High-quality downscaling filter
|
|
||||||
method = Image.ANTIALIAS
|
|
||||||
if bordersColor:
|
if bordersColor:
|
||||||
fill = bordersColor
|
fill = bordersColor
|
||||||
else:
|
else:
|
||||||
fill = self.fill
|
fill = self.fill
|
||||||
|
# Set target size
|
||||||
if qualityMode == 0:
|
if qualityMode == 0:
|
||||||
size = (self.size[0], self.size[1])
|
size = (self.size[0], self.size[1])
|
||||||
generateBorder = True
|
|
||||||
elif qualityMode == 1:
|
|
||||||
size = (self.panelviewsize[0], self.panelviewsize[1])
|
|
||||||
generateBorder = True
|
|
||||||
else:
|
else:
|
||||||
size = (self.panelviewsize[0], self.panelviewsize[1])
|
size = (self.panelviewsize[0], self.panelviewsize[1])
|
||||||
generateBorder = False
|
# If image is smaller than device resolution and upscale is off - Just expand it by adding margins
|
||||||
# If image is smaller than screen and upscale is off - Just expand it
|
if self.image.size[0] <= self.size[0] and self.image.size[1] <= self.size[1] and not upscale:
|
||||||
if self.image.size[0] <= self.size[0] and self.image.size[1] <= self.size[1]:
|
borderw = (self.size[0] - self.image.size[0]) / 2
|
||||||
if not upscale:
|
borderh = (self.size[1] - self.image.size[1]) / 2
|
||||||
borderw = (self.size[0] - self.image.size[0]) / 2
|
self.image = ImageOps.expand(self.image, border=(borderw, borderh), fill=fill)
|
||||||
borderh = (self.size[1] - self.image.size[1]) / 2
|
return self.image
|
||||||
self.image = ImageOps.expand(self.image, border=(borderw, borderh), fill=fill)
|
|
||||||
if generateBorder:
|
|
||||||
if (self.image.size[0]-(2*borderw))*1.5 < self.size[0]:
|
|
||||||
self.noHPV = True
|
|
||||||
if (self.image.size[1]-(2*borderh))*1.5 < self.size[1]:
|
|
||||||
self.noVPV = True
|
|
||||||
self.border = [int(round(float(borderw)/float(self.image.size[0])*100, 2)*100*1.5),
|
|
||||||
int(round(float(borderh)/float(self.image.size[1])*100, 2)*100*1.5)]
|
|
||||||
return self.image
|
|
||||||
else:
|
|
||||||
# Cubic spline interpolation in a 4x4 environment
|
|
||||||
method = Image.BICUBIC
|
|
||||||
# If stretching is on - Resize without other considerations
|
# If stretching is on - Resize without other considerations
|
||||||
if stretch:
|
if stretch:
|
||||||
|
if self.image.size[0] <= size[0] and self.image.size[1] <= size[1]:
|
||||||
|
method = Image.BICUBIC
|
||||||
|
else:
|
||||||
|
method = Image.ANTIALIAS
|
||||||
self.image = self.image.resize(size, method)
|
self.image = self.image.resize(size, method)
|
||||||
if generateBorder:
|
|
||||||
if fill == 'white':
|
|
||||||
border = ImageOps.invert(self.image).getbbox()
|
|
||||||
else:
|
|
||||||
border = self.image.getbbox()
|
|
||||||
if border is not None:
|
|
||||||
if (border[2]-border[0])*1.5 < self.size[0]:
|
|
||||||
self.noHPV = True
|
|
||||||
if (border[3]-border[1])*1.5 < self.size[1]:
|
|
||||||
self.noVPV = True
|
|
||||||
self.border = [int(round(float(border[0])/float(self.image.size[0])*100, 2)*100*1.5),
|
|
||||||
int(round(float(border[1])/float(self.image.size[1])*100, 2)*100*1.5)]
|
|
||||||
else:
|
|
||||||
self.border = [0, 0]
|
|
||||||
self.noHPV = True
|
|
||||||
self.noVPV = True
|
|
||||||
return self.image
|
return self.image
|
||||||
# Otherwise - Upscale/Downscale
|
# Otherwise - Upscale/Downscale
|
||||||
ratioDev = float(self.size[0]) / float(self.size[1])
|
ratioDev = float(self.size[0]) / float(self.size[1])
|
||||||
@@ -290,24 +296,12 @@ class ComicPage:
|
|||||||
self.image = ImageOps.expand(self.image, border=(int(diff / 2), 0), fill=fill)
|
self.image = ImageOps.expand(self.image, border=(int(diff / 2), 0), fill=fill)
|
||||||
elif (float(self.image.size[0]) / float(self.image.size[1])) > ratioDev:
|
elif (float(self.image.size[0]) / float(self.image.size[1])) > ratioDev:
|
||||||
diff = int(self.image.size[0] / ratioDev) - self.image.size[1]
|
diff = int(self.image.size[0] / ratioDev) - self.image.size[1]
|
||||||
self.image = ImageOps.expand(self.image, border=(0, int(diff / 2)), fill=fill)
|
self.image = ImageOps.expand(self.image, border=(0, diff / 2), fill=fill)
|
||||||
|
if self.image.size[0] <= size[0] and self.image.size[1] <= size[1]:
|
||||||
|
method = Image.BICUBIC
|
||||||
|
else:
|
||||||
|
method = Image.ANTIALIAS
|
||||||
self.image = ImageOps.fit(self.image, size, method=method, centering=(0.5, 0.5))
|
self.image = ImageOps.fit(self.image, size, method=method, centering=(0.5, 0.5))
|
||||||
if generateBorder:
|
|
||||||
if fill == 'white':
|
|
||||||
border = ImageOps.invert(self.image).getbbox()
|
|
||||||
else:
|
|
||||||
border = self.image.getbbox()
|
|
||||||
if border is not None:
|
|
||||||
if (border[2]-border[0])*1.5 < self.size[0]:
|
|
||||||
self.noHPV = True
|
|
||||||
if (border[3]-border[1])*1.5 < self.size[1]:
|
|
||||||
self.noVPV = True
|
|
||||||
self.border = [int(round(float(border[0])/float(self.image.size[0])*100, 2)*100*1.5),
|
|
||||||
int(round(float(border[1])/float(self.image.size[1])*100, 2)*100*1.5)]
|
|
||||||
else:
|
|
||||||
self.border = [0, 0]
|
|
||||||
self.noHPV = True
|
|
||||||
self.noVPV = True
|
|
||||||
return self.image
|
return self.image
|
||||||
|
|
||||||
def splitPage(self, targetdir, righttoleft=False, rotate=False):
|
def splitPage(self, targetdir, righttoleft=False, rotate=False):
|
||||||
@@ -519,4 +513,29 @@ class ComicPage:
|
|||||||
if fill > 0:
|
if fill > 0:
|
||||||
self.fill = 'black'
|
self.fill = 'black'
|
||||||
else:
|
else:
|
||||||
self.fill = 'white'
|
self.fill = 'white'
|
||||||
|
|
||||||
|
def isImageColor(self, image):
|
||||||
|
v = ImageStat.Stat(image).var
|
||||||
|
isMonochromatic = reduce(lambda x, y: x and y < 0.005, v, True)
|
||||||
|
if isMonochromatic:
|
||||||
|
# Monochromatic
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if len(v) == 3:
|
||||||
|
maxmin = abs(max(v) - min(v))
|
||||||
|
if maxmin > 1000:
|
||||||
|
# Color
|
||||||
|
return True
|
||||||
|
elif maxmin > 100:
|
||||||
|
# Probably color
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
# Grayscale
|
||||||
|
return False
|
||||||
|
elif len(v) == 1:
|
||||||
|
# Black and white
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
# Detection failed
|
||||||
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user