mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-04-11 08:50:58 +00:00
Improve BasicCrop API as discussed in #94
This commit is contained in:
parent
15e0981835
commit
51212749e9
1 changed files with 7 additions and 8 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue