mirror of
https://github.com/ciromattia/kcc
synced 2026-01-27 23:47:41 +00:00
@@ -361,6 +361,13 @@ The app relies and includes the following scripts/binaries:
|
||||
* Fixed problems with page order on stock KOBO CBZ reader
|
||||
* Many other small bug fixes and tweaks
|
||||
|
||||
####4.2.1:
|
||||
* Improved margin color detection
|
||||
* Fixed random crashes of MOBI processing step
|
||||
* Fixed resizing problems in high quality mode
|
||||
* Fixed some MCD support bugs
|
||||
* Default output format for Kindle DX is now CBZ
|
||||
|
||||
## KNOWN ISSUES
|
||||
Please check [wiki page](https://github.com/ciromattia/kcc/wiki/Known-issues).
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
__version__ = '4.2'
|
||||
__version__ = '4.2.1'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = '2012-2014, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
__version__ = '4.2'
|
||||
__version__ = '4.2.1'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = '2012-2014, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
2
kcc.iss
2
kcc.iss
@@ -1,5 +1,5 @@
|
||||
#define MyAppName "Kindle Comic Converter"
|
||||
#define MyAppVersion "4.2"
|
||||
#define MyAppVersion "4.2.1"
|
||||
#define MyAppPublisher "Ciro Mattia Gonano, Paweł Jastrzębski"
|
||||
#define MyAppURL "http://kcc.iosphe.re/"
|
||||
#define MyAppExeName "KCC.exe"
|
||||
|
||||
2
kcc.py
2
kcc.py
@@ -18,7 +18,7 @@
|
||||
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
__version__ = '4.2'
|
||||
__version__ = '4.2.1'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = '2012-2014, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
__version__ = '4.2'
|
||||
__version__ = '4.2.1'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = '2012-2014, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
@@ -491,6 +491,8 @@ class WorkerThread(QtCore.QThread):
|
||||
worker.signals.result.connect(self.addResult)
|
||||
self.pool.start(worker)
|
||||
self.pool.waitForDone()
|
||||
while len(self.workerOutput) != len(outputPath):
|
||||
sleep(0.1)
|
||||
self.kindlegenErrorCode = [0]
|
||||
for errors in self.workerOutput:
|
||||
if errors[0] != 0:
|
||||
@@ -517,6 +519,8 @@ class WorkerThread(QtCore.QThread):
|
||||
worker.signals.result.connect(self.addResult)
|
||||
self.pool.start(worker)
|
||||
self.pool.waitForDone()
|
||||
while len(self.workerOutput) != len(outputPath):
|
||||
sleep(0.1)
|
||||
for success in self.workerOutput:
|
||||
if not success[0]:
|
||||
self.errors = True
|
||||
@@ -1121,7 +1125,7 @@ class KCCGUI(KCC_ui.Ui_KCC):
|
||||
'DefaultUpscale': False, 'Label': 'KHD'},
|
||||
"Kindle": {'Quality': True, 'ForceExpert': False, 'DefaultFormat': 0,
|
||||
'DefaultUpscale': False, 'Label': 'K345'},
|
||||
"Kindle DX/DXG": {'Quality': False, 'ForceExpert': False, 'DefaultFormat': 0,
|
||||
"Kindle DX/DXG": {'Quality': False, 'ForceExpert': False, 'DefaultFormat': 2,
|
||||
'DefaultUpscale': False, 'Label': 'KDX'},
|
||||
"Kindle Fire": {'Quality': True, 'ForceExpert': False, 'DefaultFormat': 0,
|
||||
'DefaultUpscale': False, 'Label': 'KF'},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
__version__ = '4.2'
|
||||
__version__ = '4.2.1'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = '2012-2014, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
@@ -18,7 +18,7 @@
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
__version__ = '4.2'
|
||||
__version__ = '4.2.1'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = '2012-2014, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
@@ -214,10 +214,6 @@ def buildNCX(dstdir, title, chapters, chapterNames):
|
||||
def buildOPF(dstdir, title, filelist, cover=None):
|
||||
opffile = os.path.join(dstdir, 'OEBPS', 'content.opf')
|
||||
profilelabel, deviceres, palette, gamma, panelviewsize = options.profileData
|
||||
if options.quality == 1:
|
||||
imgres = str(panelviewsize[0]) + "x" + str(panelviewsize[1])
|
||||
else:
|
||||
imgres = str(deviceres[0]) + "x" + str(deviceres[1])
|
||||
if options.righttoleft:
|
||||
writingmode = "horizontal-rl"
|
||||
else:
|
||||
@@ -244,7 +240,8 @@ def buildOPF(dstdir, title, filelist, cover=None):
|
||||
"<meta name=\"fixed-layout\" content=\"true\"/>\n"
|
||||
"<meta name=\"rendition:orientation\" content=\"portrait\"/>\n",
|
||||
"<meta name=\"orientation-lock\" content=\"portrait\"/>\n",
|
||||
"<meta name=\"original-resolution\" content=\"", imgres, "\"/>\n",
|
||||
"<meta name=\"original-resolution\" content=\"",
|
||||
str(deviceres[0]) + "x" + str(deviceres[1]), "\"/>\n",
|
||||
"<meta name=\"primary-writing-mode\" content=\"", writingmode, "\"/>\n",
|
||||
"<meta name=\"ke-border-color\" content=\"#ffffff\"/>\n",
|
||||
"<meta name=\"ke-border-width\" content=\"0\"/>\n",
|
||||
@@ -428,7 +425,7 @@ def buildEPUB(path, chapterNames, tomeNumber):
|
||||
|
||||
def imgOptimization(img, opt, hqImage=None):
|
||||
if not img.fill:
|
||||
img.getImageFill(opt.webtoon)
|
||||
img.getImageFill()
|
||||
if not opt.webtoon:
|
||||
img.cropWhiteSpace()
|
||||
if opt.cutpagenumbers and not opt.webtoon:
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
__version__ = '4.2'
|
||||
__version__ = '4.2.1'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = '2012-2014, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
75
kcc/image.py
75
kcc/image.py
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__version__ = '4.2'
|
||||
__version__ = '4.2.1'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = '2012-2014, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
@@ -24,6 +24,7 @@ __docformat__ = 'restructuredtext en'
|
||||
import os
|
||||
from io import BytesIO
|
||||
from urllib.request import Request, urlopen
|
||||
from urllib.parse import quote
|
||||
from functools import reduce
|
||||
from PIL import Image, ImageOps, ImageStat, ImageChops
|
||||
from .shared import md5Checksum
|
||||
@@ -403,50 +404,44 @@ class ComicPage:
|
||||
|
||||
def getImageHistogram(self, image):
|
||||
histogram = image.histogram()
|
||||
RBGW = []
|
||||
pixelCount = 0
|
||||
for i in range(256):
|
||||
pixelCount += histogram[i] + histogram[256 + i] + histogram[512 + i]
|
||||
RBGW.append(histogram[i] + histogram[256 + i] + histogram[512 + i])
|
||||
white = 0
|
||||
black = 0
|
||||
for i in range(251, 256):
|
||||
white += RBGW[i]
|
||||
for i in range(5):
|
||||
black += RBGW[i]
|
||||
if black > pixelCount*0.8 and white == 0:
|
||||
return 1
|
||||
elif white > pixelCount*0.8 and black == 0:
|
||||
if histogram[0] == 0:
|
||||
return -1
|
||||
elif histogram[255] == 0:
|
||||
return 1
|
||||
else:
|
||||
return False
|
||||
return 0
|
||||
|
||||
def getImageFill(self, webtoon):
|
||||
fill = 0
|
||||
if not webtoon and not self.rotated:
|
||||
# Search for horizontal solid lines
|
||||
startY = 0
|
||||
while startY < self.image.size[1]:
|
||||
if startY + 5 > self.image.size[1]:
|
||||
startY = self.image.size[1] - 5
|
||||
checkSolid = self.getImageHistogram(self.image.crop((0, startY, self.image.size[0], startY+5)))
|
||||
if checkSolid:
|
||||
fill += checkSolid
|
||||
startY += 5
|
||||
def getImageFill(self):
|
||||
bw = self.image.convert('L').point(lambda x: 0 if x < 128 else 255, '1')
|
||||
imageBoxA = bw.getbbox()
|
||||
imageBoxB = ImageChops.invert(bw).getbbox()
|
||||
if imageBoxA is None or imageBoxB is None:
|
||||
surfaceB, surfaceW = 0, 0
|
||||
else:
|
||||
# Search for vertical solid lines
|
||||
startX = 0
|
||||
while startX < self.image.size[0]:
|
||||
if startX + 5 > self.image.size[0]:
|
||||
startX = self.image.size[0] - 5
|
||||
checkSolid = self.getImageHistogram(self.image.crop((startX, 0, startX+5, self.image.size[1])))
|
||||
if checkSolid:
|
||||
fill += checkSolid
|
||||
startX += 5
|
||||
if fill > 0:
|
||||
surfaceB = (imageBoxA[2] - imageBoxA[0]) * (imageBoxA[3] - imageBoxA[1])
|
||||
surfaceW = (imageBoxB[2] - imageBoxB[0]) * (imageBoxB[3] - imageBoxB[1])
|
||||
if surfaceW < surfaceB:
|
||||
self.fill = 'white'
|
||||
elif surfaceW > surfaceB:
|
||||
self.fill = 'black'
|
||||
else:
|
||||
self.fill = 'white'
|
||||
fill = 0
|
||||
startY = 0
|
||||
while startY < bw.size[1]:
|
||||
if startY + 5 > bw.size[1]:
|
||||
startY = bw.size[1] - 5
|
||||
fill += self.getImageHistogram(bw.crop((0, startY, bw.size[0], startY+5)))
|
||||
startY += 5
|
||||
startX = 0
|
||||
while startX < bw.size[0]:
|
||||
if startX + 5 > bw.size[0]:
|
||||
startX = bw.size[0] - 5
|
||||
fill += self.getImageHistogram(bw.crop((startX, 0, startX+5, bw.size[1])))
|
||||
startX += 5
|
||||
if fill > 0:
|
||||
self.fill = 'black'
|
||||
else:
|
||||
self.fill = 'white'
|
||||
|
||||
def isImageColor(self):
|
||||
v = ImageStat.Stat(self.image).var
|
||||
@@ -485,7 +480,7 @@ class Cover:
|
||||
self.tomeNumber = tomeNumber
|
||||
if self.tomeNumber in self.options.remoteCovers:
|
||||
try:
|
||||
source = urlopen(Request(self.options.remoteCovers[self.tomeNumber],
|
||||
source = urlopen(Request(quote(self.options.remoteCovers[self.tomeNumber]).replace('%3A', ':', 1),
|
||||
headers={'User-Agent': 'KindleComicConverter/' + __version__})).read()
|
||||
self.image = Image.open(BytesIO(source))
|
||||
self.processExternal()
|
||||
|
||||
2
setup.py
2
setup.py
@@ -14,7 +14,7 @@ if version_info[0] != 3:
|
||||
exit(1)
|
||||
|
||||
NAME = "KindleComicConverter"
|
||||
VERSION = "4.2"
|
||||
VERSION = "4.2.1"
|
||||
MAIN = "kcc.py"
|
||||
|
||||
if platform == "darwin":
|
||||
|
||||
Reference in New Issue
Block a user