Skip to content

Commit

Permalink
Fixed errors in image.py introduced from the different handling of di…
Browse files Browse the repository at this point in the history
…vision between python 2 and 3
  • Loading branch information
moshev authored and AcidWeb committed Jan 29, 2014
1 parent f5f5c05 commit 062b239
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kcc/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 062b239

Please sign in to comment.