about summary refs log tree commit diff
path: root/kcc/image.py
diff options
context:
space:
mode:
authorMoshev <mo6eeeb@gmail.com>2014-01-29 00:01:07 +0200
committerPaweł Jastrzębski <pawelj@vulturis.eu>2014-01-29 08:14:00 +0100
commit062b239f2fc00592f7032f9cb2dfe96d45d76129 (patch)
tree148def59794177dbae39083e8271727125804698 /kcc/image.py
parentMerge pull request #82 from ciromattia/python3 (diff)
downloadkcc-062b239f2fc00592f7032f9cb2dfe96d45d76129.tar.gz
kcc-062b239f2fc00592f7032f9cb2dfe96d45d76129.tar.bz2
kcc-062b239f2fc00592f7032f9cb2dfe96d45d76129.zip
Fixed errors in image.py introduced from the different handling of division between python 2 and 3
Diffstat (limited to 'kcc/image.py')
-rwxr-xr-xkcc/image.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/kcc/image.py b/kcc/image.py
index cbdcc88..4015af6 100755
--- a/kcc/image.py
+++ b/kcc/image.py
@@ -165,7 +165,7 @@ class ComicPage:
             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 @@ class ComicPage:
             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 @@ class ComicPage:
             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