1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 01:36:27 +00:00

try to crop only main cover from wide cover scan (#875)

This commit is contained in:
Alex Xu
2025-03-21 10:17:23 -07:00
committed by GitHub
parent 9680ff24c2
commit 4337d6c10d

View File

@@ -433,9 +433,14 @@ class Cover:
w, h = self.image.size
if w / h > 2:
if self.options.righttoleft:
self.image = self.image.crop((0, 0, w/2 + w * 0.02, h))
self.image = self.image.crop((w/6, 0, w/2 - w * 0.02, h))
else:
self.image = self.image.crop((w/2 - w * 0.02, 0, w, h))
self.image = self.image.crop((w/2 + w * 0.02, 0, 5/6 * w, h))
elif w / h > 1.3:
if self.options.righttoleft:
self.image = self.image.crop((0, 0, w/2 - w * 0.03, h))
else:
self.image = self.image.crop((w/2 + w * 0.03, 0, w, h))
self.image.thumbnail(self.options.profileData[1], Image.Resampling.LANCZOS)
self.save()