Improve BasicCrop API as discussed in #94

This commit is contained in:
Matthew Tretter 2012-02-11 15:28:47 -05:00
parent 15e0981835
commit 51212749e9

View file

@ -75,16 +75,15 @@ class BasicCrop(object):
"""Crops an image to the specified rectangular region.
"""
def __init__(self, left, top, right, bottom):
self.left = left
self.top = top
self.right = right
self.bottom = bottom
def __init__(self, x, y, width, height):
self.x = x
self.y = y
self.width = width
self.height = height
def process(self, img):
box = (self.left, self.top, self.right, self.bottom)
img = img.crop(box)
return img
box = (self.x, self.y, self.x + self.width, self.y + self.height)
return img.crop(box)
class Crop(object):