Skip to content

Commit b0374e1

Browse files
authored
Smarter covers (ciromattia#1300)
* smart crop semi-wide covers * make it even smarter * make it even smarter * adjust ratio
1 parent 894dbfc commit b0374e1

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎kindlecomicconverter/image.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,12 +608,30 @@ def crop_main_cover(self):
608608
self.image = self.image.crop((w/6, 0, w/2 - w * 0.02, h))
609609
else:
610610
self.image = self.image.crop((w/2 + w * 0.02, 0, 5/6 * w, h))
611+
elif w / h > 1.83:
612+
self.smartcover = True
613+
if self.options.righttoleft:
614+
self.image = self.image.crop((w * .19, 0, w * .575, h))
615+
else:
616+
self.image = self.image.crop((w * .425, 0, .81 * w, h))
617+
elif w / h > 1.7:
618+
self.smartcover = True
619+
if self.options.righttoleft:
620+
self.image = self.image.crop((w * .2, 0, w * .583, h))
621+
else:
622+
self.image = self.image.crop((w * .417, 0, .8 * w, h))
611623
elif w / h > 1.34:
612624
self.smartcover = True
613625
if self.options.righttoleft:
614626
self.image = self.image.crop((0, 0, w/2 - w * 0.03, h))
615627
else:
616628
self.image = self.image.crop((w/2 + w * 0.03, 0, w, h))
629+
elif w / h > 1.0:
630+
self.smartcover = True
631+
if self.options.righttoleft:
632+
self.image = self.image.crop((w * .36, 0, w, h))
633+
else:
634+
self.image = self.image.crop((w, 0, .64 * w, h))
617635

618636
def save_to_folder(self, target, tomeid, len_tomes=0):
619637
try:

0 commit comments

Comments
 (0)