Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
Whoops, wasn't *actually* cropping
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Sinchok committed Apr 15, 2014
1 parent d69900d commit 986fe88
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions betty/cropper/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ def crop(self, ratio, width, extension, fp=None):

selection = self.get_selection(ratio)
try:
img.crop((selection['x0'], selection['y0'], selection['x1'], selection['y1']))
img = img.crop((selection['x0'], selection['y0'], selection['x1'], selection['y1']))
except ValueError:
# Looks like we have bad height and width data. Let's reload that and try again.
self.width = img.size[0]
self.height = img.size[1]
self.save()

selection = self.get_selection(ratio)
img.crop((selection['x0'], selection['y0'], selection['x1'], selection['y1']))
img = img.crop((selection['x0'], selection['y0'], selection['x1'], selection['y1']))

height = int(round(width * float(ratio.height) / float(ratio.width)))
img = img.resize((width, height), PILImage.ANTIALIAS)
Expand Down

0 comments on commit 986fe88

Please sign in to comment.