diff --git a/CHANGELOG.md b/CHANGELOG.md index e5e84f7b..0f855692 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +#### 5.5.3-beta-darodi.7: +* Option in GUI to have PNG instead of jpg images [ciromattia/kcc#439](https://github.com/ciromattia/kcc/issues/439), thanks [@darodi](https://github.com/darodi) + #### 5.5.3-beta-darodi.6: * Option in GUI to have PNG instead of jpg images [darodi/kcc#3](https://github.com/darodi/kcc/issues/3), thanks [@darodi](https://github.com/darodi) diff --git a/gui/KCC.ui b/gui/KCC.ui index aa0eb664..861046b4 100644 --- a/gui/KCC.ui +++ b/gui/KCC.ui @@ -162,6 +162,16 @@ + + + + <html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Unchecked - 1x4<br/></span>Keep format 1x4 panels strips.</p><p><span style=" font-weight:600; text-decoration: underline;">Checked - 2x2<br/></span>Turn 1x4 strips to 2x2 to maximize screen usage.</p></body></html> + + + 1x4 to 2x2 strips + + + diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index cefecb1f..5b756e24 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -280,6 +280,8 @@ def run(self): options.batchsplit = 2 if GUI.colorBox.isChecked(): options.forcecolor = True + if GUI.maximizeStrips.isChecked(): + options.maximizestrips = True if GUI.disableProcessingBox.isChecked(): options.noprocessing = True if GUI.mozJpegBox.checkState() == 1: @@ -796,6 +798,7 @@ def saveSettings(self, event): 'mozJpegBox': GUI.mozJpegBox.checkState(), 'widthBox': GUI.widthBox.value(), 'heightBox': GUI.heightBox.value(), + 'maximizeStrips': GUI.maximizeStrips.checkState(), 'gammaSlider': float(self.gammaValue) * 100}) self.settings.sync() self.tray.hide() diff --git a/kindlecomicconverter/KCC_ui.py b/kindlecomicconverter/KCC_ui.py index 188c7b54..b9f1b8c3 100644 --- a/kindlecomicconverter/KCC_ui.py +++ b/kindlecomicconverter/KCC_ui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'gui/KCC.ui' # -# Created by: PyQt5 UI code generator 5.15.4 +# Created by: PyQt5 UI code generator 5.15.6 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. @@ -65,7 +65,10 @@ def setupUi(self, mainWindow): self.mozJpegBox = QtWidgets.QCheckBox(self.optionWidget) self.mozJpegBox.setTristate(True) self.mozJpegBox.setObjectName("mozJpegBox") - self.gridLayout_2.addWidget(self.mozJpegBox, 3, 1, 1, 1) + self.gridLayout_2.addWidget(self.mozJpegBox, 3, 0, 1, 1) + self.maximizeStrips = QtWidgets.QCheckBox(self.optionWidget) + self.maximizeStrips.setObjectName("maximizeStrips") + self.gridLayout_2.addWidget(self.maximizeStrips, 3, 1, 1, 1) self.gridLayout.addWidget(self.optionWidget, 4, 0, 1, 2) self.gammaWidget = QtWidgets.QWidget(self.centralWidget) self.gammaWidget.setVisible(False) @@ -264,6 +267,8 @@ def retranslateUi(self, mainWindow): self.disableProcessingBox.setText(_translate("mainWindow", "Disable processing")) self.mozJpegBox.setToolTip(_translate("mainWindow", "

Unchecked - JPEG
Use JPEG files

Indeterminate - force PNG
Create PNG files instead JPEG

Checked - mozJpeg
10-20% smaller JPEG file, with the same image quality, but processing time multiplied by 2

")) self.mozJpegBox.setText(_translate("mainWindow", "JPEG/PNG/mozJpeg")) + self.maximizeStrips.setToolTip(_translate("mainWindow", "

Unchecked - 1x4
Keep format 1x4 panels strips.

Checked - 2x2
Turn 1x4 strips to 2x2 to maximize screen usage.

")) + self.maximizeStrips.setText(_translate("mainWindow", "1x4 to 2x2 strips")) self.gammaLabel.setText(_translate("mainWindow", "Gamma: Auto")) self.directoryButton.setToolTip(_translate("mainWindow", "

Add directory containing JPG, PNG or GIF files to queue.
CBR, CBZ and CB7 files inside will not be processed!

")) self.directoryButton.setText(_translate("mainWindow", "Add directory")) diff --git a/kindlecomicconverter/__init__.py b/kindlecomicconverter/__init__.py index 3fc7584b..85440073 100644 --- a/kindlecomicconverter/__init__.py +++ b/kindlecomicconverter/__init__.py @@ -1,4 +1,4 @@ -__version__ = '5.5.3-beta-darodi.6' +__version__ = '5.5.3-beta-darodi.7' __license__ = 'ISC' __copyright__ = '2012-2022, Ciro Mattia Gonano , Pawel Jastrzebski , darodi' __docformat__ = 'restructuredtext en' diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index 5f8649d3..4656283c 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -954,7 +954,8 @@ def makeParser(): help="Create PNG files instead JPEG") processingOptions.add_option("--mozjpeg", action="store_true", dest="mozjpeg", default=False, help="Create JPEG files using mozJpeg") - + processingOptions.add_option("--maximizestrips", action="store_true", dest="maximizestrips", default=False, + help="Turn 1x4 strips to 2x2 strips") customProfileOptions.add_option("--customwidth", type="int", dest="customwidth", default=0, help="Replace screen width provided by device profile") customProfileOptions.add_option("--customheight", type="int", dest="customheight", default=0, diff --git a/kindlecomicconverter/image.py b/kindlecomicconverter/image.py index 809fc9e2..e584c16f 100755 --- a/kindlecomicconverter/image.py +++ b/kindlecomicconverter/image.py @@ -124,7 +124,20 @@ def getImageHistogram(self, image): def splitCheck(self): width, height = self.image.size dstwidth, dstheight = self.size - if (width > height) != (dstwidth > dstheight) and width <= dstheight and height <= dstwidth \ + if self.opt.maximizestrips: + leftbox = (0, 0, int(width / 2), height) + rightbox = (int(width / 2), 0, width, height) + if self.opt.righttoleft: + pageone = self.image.crop(rightbox) + pagetwo = self.image.crop(leftbox) + else: + pageone = self.image.crop(leftbox) + pagetwo = self.image.crop(rightbox) + new_image = Image.new("RGB", (int(width / 2), int(height*2))) + new_image.paste(pageone, (0, 0)) + new_image.paste(pagetwo, (0, height)) + self.payload.append(['N', self.source, new_image, self.color, self.fill]) + elif (width > height) != (dstwidth > dstheight) and width <= dstheight and height <= dstwidth \ and not self.opt.webtoon and self.opt.splitter == 1: self.payload.append(['R', self.source, self.image.rotate(90, Image.BICUBIC, True), self.color, self.fill]) elif (width > height) != (dstwidth > dstheight) and not self.opt.webtoon: