From 062b239f2fc00592f7032f9cb2dfe96d45d76129 Mon Sep 17 00:00:00 2001 From: Moshev Date: Wed, 29 Jan 2014 00:01:07 +0200 Subject: [PATCH] Fixed errors in image.py introduced from the different handling of division between python 2 and 3 --- kcc/image.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kcc/image.py b/kcc/image.py index cbdcc88d..4015af62 100755 --- a/kcc/image.py +++ b/kcc/image.py @@ -165,7 +165,7 @@ def optimizeImage(self, gamma): self.image = ImageOps.autocontrast(Image.eval(self.image, lambda a: 255 * (a / 255.) ** gamma)) def quantizeImage(self): - colors = len(self.palette) / 3 + colors = len(self.palette) // 3 if colors < 256: self.palette += self.palette[:3] * (256 - colors) palImg = Image.new('P', (1, 1)) @@ -322,7 +322,7 @@ def cutPageNumber(self): oldStat = ImageStat.Stat(self.image.crop((0, heightImg - diff, widthImg, heightImg))).var[0] diff += delta while ImageStat.Stat(self.image.crop((0, heightImg - diff, widthImg, heightImg))).var[0] - oldStat > 0\ - and diff < heightImg / 4: + and diff < heightImg // 4: oldStat = ImageStat.Stat(self.image.crop((0, heightImg - diff, widthImg, heightImg))).var[0] diff += delta diff -= delta @@ -331,7 +331,7 @@ def cutPageNumber(self): oldStat = ImageStat.Stat(self.image.crop((0, heightImg - diff, widthImg, heightImg - pageNumberCut2))).var[0] while ImageStat.Stat(self.image.crop((0, heightImg - diff, widthImg, heightImg - pageNumberCut2))).var[0]\ - < fixedThreshold + oldStat and diff < heightImg / 4: + < fixedThreshold + oldStat and diff < heightImg // 4: diff += delta diff -= delta pageNumberCut3 = diff