mirror of
https://github.com/ciromattia/kcc
synced 2026-05-29 18:53:07 +00:00
PDF PNG half size, Kindle DX PNG CBZ fixed (#1267)
* PNG for PDF or Kindle DX CBZ is dithered to 16 colors for ~1/2 filesize reduction * Kindle DX default no borders
This commit is contained in:
@@ -883,6 +883,8 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
if bad_format in current_format:
|
if bad_format in current_format:
|
||||||
self.addMessage('Colorsoft MOBI/EPUB can have blank pages. Just go back a few pages, exit, and reenter book.', 'info')
|
self.addMessage('Colorsoft MOBI/EPUB can have blank pages. Just go back a few pages, exit, and reenter book.', 'info')
|
||||||
break
|
break
|
||||||
|
elif profile['Label'] == 'KDX':
|
||||||
|
GUI.borderBox.setCheckState(Qt.CheckState.PartiallyChecked)
|
||||||
if not profile['PVOptions']:
|
if not profile['PVOptions']:
|
||||||
GUI.qualityBox.setChecked(False)
|
GUI.qualityBox.setChecked(False)
|
||||||
if str(GUI.deviceBox.currentText()) == 'Other':
|
if str(GUI.deviceBox.currentText()) == 'Other':
|
||||||
@@ -909,7 +911,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
elif not GUI.webtoonBox.isChecked():
|
elif not GUI.webtoonBox.isChecked():
|
||||||
GUI.chunkSizeCheckBox.setEnabled(True)
|
GUI.chunkSizeCheckBox.setEnabled(True)
|
||||||
if GUI.formats[str(GUI.formatBox.currentText())]['format'] in ('CBZ', 'PDF') and not GUI.webtoonBox.isChecked():
|
if GUI.formats[str(GUI.formatBox.currentText())]['format'] in ('CBZ', 'PDF') and not GUI.webtoonBox.isChecked():
|
||||||
self.addMessage("Partially check W/B Margins if you don't want KCC to extend the image margins.", 'info')
|
self.addMessage("Partially check W/B Margins if you don't want KCC to extend the image margins.", 'info')
|
||||||
|
|
||||||
def stripTags(self, html):
|
def stripTags(self, html):
|
||||||
s = HTMLStripper()
|
s = HTMLStripper()
|
||||||
|
|||||||
@@ -707,8 +707,11 @@ def imgFileProcessing(work):
|
|||||||
pass
|
pass
|
||||||
elif opt.forcepng:
|
elif opt.forcepng:
|
||||||
img.convertToGrayscale()
|
img.convertToGrayscale()
|
||||||
if opt.format != 'PDF':
|
img.quantizeImage()
|
||||||
img.quantizeImage()
|
if opt.format == 'PDF':
|
||||||
|
img.convertToGrayscale()
|
||||||
|
elif opt.profile == 'KDX' and opt.format == 'CBZ':
|
||||||
|
img.convertToGrayscale()
|
||||||
else:
|
else:
|
||||||
img.convertToGrayscale()
|
img.convertToGrayscale()
|
||||||
output.append(img.saveToDir())
|
output.append(img.saveToDir())
|
||||||
@@ -1487,9 +1490,6 @@ def checkOptions(options):
|
|||||||
if 'Ko' in options.profile:
|
if 'Ko' in options.profile:
|
||||||
options.panelview = False
|
options.panelview = False
|
||||||
options.hq = False
|
options.hq = False
|
||||||
# CBZ files on Kindle DX/DXG support higher resolution
|
|
||||||
if options.profile == 'KDX' and options.format == 'CBZ':
|
|
||||||
options.customheight = 1200
|
|
||||||
# KFX output create EPUB that might be can be by jhowell KFX Output Calibre plugin
|
# KFX output create EPUB that might be can be by jhowell KFX Output Calibre plugin
|
||||||
if options.format == 'KFX':
|
if options.format == 'KFX':
|
||||||
options.format = 'EPUB'
|
options.format = 'EPUB'
|
||||||
@@ -1515,6 +1515,13 @@ def checkOptions(options):
|
|||||||
options.jpegquality = 85
|
options.jpegquality = 85
|
||||||
options.kindle_azw3 = options.iskindle and ('MOBI' in options.format or 'EPUB' in options.format)
|
options.kindle_azw3 = options.iskindle and ('MOBI' in options.format or 'EPUB' in options.format)
|
||||||
options.kindle_scribe_azw3 = options.profile.startswith('KS') and options.kindle_azw3
|
options.kindle_scribe_azw3 = options.profile.startswith('KS') and options.kindle_azw3
|
||||||
|
|
||||||
|
# CBZ files on Kindle DX/DXG support higher resolution
|
||||||
|
if options.profile == 'KDX' and options.format == 'CBZ':
|
||||||
|
options.profileData = list(image.ProfileData.Profiles[options.profile])
|
||||||
|
options.profileData[1] = list(options.profileData[1])
|
||||||
|
options.profileData[1][1] = 1200
|
||||||
|
|
||||||
if options.kindle_scribe_azw3:
|
if options.kindle_scribe_azw3:
|
||||||
options.profileData = list(image.ProfileData.Profiles[options.profile])
|
options.profileData = list(image.ProfileData.Profiles[options.profile])
|
||||||
options.profileData[1] = list(options.profileData[1])
|
options.profileData[1] = list(options.profileData[1])
|
||||||
|
|||||||
Reference in New Issue
Block a user