mirror of
https://github.com/ciromattia/kcc
synced 2025-12-16 03:06:33 +00:00
Fixed Panel View bugs
This commit is contained in:
@@ -105,9 +105,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"]
|
||||||
@@ -166,11 +166,11 @@ def buildHTML(path, imgfile):
|
|||||||
"BoxTR": "right:" + xr + ";top:" + yu + ";",
|
"BoxTR": "right:" + xr + ";top:" + yu + ";",
|
||||||
"BoxBL": "left:" + xl + ";bottom:" + yd + ";",
|
"BoxBL": "left:" + xl + ";bottom:" + yd + ";",
|
||||||
"BoxBR": "right:" + xr + ";bottom:" + yd + ";",
|
"BoxBR": "right:" + xr + ";bottom:" + yd + ";",
|
||||||
"BoxT": "left:" + xl + ";top:" + yu + ";",
|
"BoxT": "left:-25%;top:" + yu + ";",
|
||||||
"BoxB": "left:" + xl + ";bottom:" + yd + ";",
|
"BoxB": "left:-25%;bottom:" + yd + ";",
|
||||||
"BoxL": "left:" + xl + ";top:" + yu + ";",
|
"BoxL": "left:" + xl + ";top:-25%;",
|
||||||
"BoxR": "right:" + xr + ";top:" + yu + ";",
|
"BoxR": "right:" + xr + ";top:-25%;",
|
||||||
"BoxC": "left:" + xl + ";top:" + yu + ";"
|
"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=\"",
|
||||||
@@ -318,11 +318,14 @@ def applyImgOptimization(img, opt, hqImage=None):
|
|||||||
img.optimizeImage(opt.gamma)
|
img.optimizeImage(opt.gamma)
|
||||||
if hqImage:
|
if hqImage:
|
||||||
img.resizeImage(opt.upscale, opt.stretch, opt.bordersColor, 0)
|
img.resizeImage(opt.upscale, opt.stretch, opt.bordersColor, 0)
|
||||||
img.calculateBorder(hqImage)
|
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 and opt.quality != 2:
|
if opt.panelview:
|
||||||
img.calculateBorder(img)
|
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()
|
||||||
|
|
||||||
|
|||||||
12
kcc/image.py
12
kcc/image.py
@@ -239,7 +239,7 @@ class ComicPage:
|
|||||||
else:
|
else:
|
||||||
return int(round(float(x)/float(img.image.size[1]), 4) * 10000 * 1.5)
|
return int(round(float(x)/float(img.image.size[1]), 4) * 10000 * 1.5)
|
||||||
|
|
||||||
def calculateBorder(self, sourceImage):
|
def calculateBorder(self, sourceImage, isHQ=False):
|
||||||
if self.fill == 'white':
|
if self.fill == 'white':
|
||||||
# This code trigger only when sourceImage is already saved. So we can break color quantization.
|
# This code trigger only when sourceImage is already saved. So we can break color quantization.
|
||||||
if sourceImage.image.mode == 'P':
|
if sourceImage.image.mode == 'P':
|
||||||
@@ -248,16 +248,18 @@ class ComicPage:
|
|||||||
else:
|
else:
|
||||||
border = sourceImage.image.getbbox()
|
border = sourceImage.image.getbbox()
|
||||||
if border is not None:
|
if border is not None:
|
||||||
|
if isHQ:
|
||||||
|
multiplier = 1.0
|
||||||
|
else:
|
||||||
|
multiplier = 1.5
|
||||||
self.border = [self.calculateBorderPercent(border[0], sourceImage, True),
|
self.border = [self.calculateBorderPercent(border[0], sourceImage, True),
|
||||||
self.calculateBorderPercent(border[1], sourceImage, False),
|
self.calculateBorderPercent(border[1], sourceImage, False),
|
||||||
self.calculateBorderPercent((sourceImage.image.size[0] - border[2]), sourceImage, True),
|
self.calculateBorderPercent((sourceImage.image.size[0] - border[2]), sourceImage, True),
|
||||||
self.calculateBorderPercent((sourceImage.image.size[1] - border[3]), sourceImage, False)]
|
self.calculateBorderPercent((sourceImage.image.size[1] - border[3]), sourceImage, False)]
|
||||||
if int((border[2] - border[0]) * 1.5) < self.size[0]:
|
if int((border[2] - border[0]) * multiplier) < self.size[0]:
|
||||||
self.noHPV = True
|
self.noHPV = True
|
||||||
self.border[0] /= 2
|
if int((border[3] - border[1]) * multiplier) < self.size[1]:
|
||||||
if int((border[3] - border[1]) * 1.5) < self.size[1]:
|
|
||||||
self.noVPV = True
|
self.noVPV = True
|
||||||
self.border[1] /= 2
|
|
||||||
else:
|
else:
|
||||||
self.border = [0, 0, 0, 0]
|
self.border = [0, 0, 0, 0]
|
||||||
self.noHPV = True
|
self.noHPV = True
|
||||||
|
|||||||
Reference in New Issue
Block a user