1. Joseph Tate
  2. tw2.upload

Commits

Joseph Tate  committed 56300df

Fix crop region rounding errors

  • Participants
  • Parent commits a586bd8
  • Branches default

Comments (0)

Files changed (1)

File tw2/upload/model/image.py

View file
         base_w, base_h = self.extents.values()[-1]
         if base_w/float(base_h) < w/float(h):
             #Picture's width to height ratio is higher than the extent's
-            crop_size = int(h * (base_w / float(base_h))), h
+            crop_size = int(round(h * (base_w / float(base_h)))), h
         else:
-            crop_size = w, int(w * (base_h /float(base_w)))
+            crop_size = w, int(round(w * (base_h /float(base_w))))
         return crop_size
         
     def crop_region(self, w, h):