Documentation

This commit is contained in:
Matthew Tretter 2012-02-11 15:40:16 -05:00
parent 80a26a4f09
commit cf821cfecd
2 changed files with 32 additions and 5 deletions

View file

@ -76,6 +76,13 @@ class BasicCrop(object):
"""
def __init__(self, x, y, width, height):
"""
:param x: The x position of the clipping box, in pixels.
:param y: The y position of the clipping box, in pixels.
:param width: The width position of the clipping box, in pixels.
:param height: The height position of the clipping box, in pixels.
"""
self.x = x
self.y = y
self.width = width
@ -163,15 +170,20 @@ class Crop(object):
class SmartCrop(object):
"""
Crop an image 'smartly' -- based on smart crop implementation from easy-thumbnails:
Crop an image to the specified dimensions, whittling away the parts of the
image with the least entropy.
Based on smart crop implementation from easy-thumbnails:
https://github.com/SmileyChris/easy-thumbnails/blob/master/easy_thumbnails/processors.py#L193
Smart cropping whittles away the parts of the image with the least entropy.
"""
def __init__(self, width=None, height=None):
"""
:param width: The target width, in pixels.
:param height: The target height, in pixels.
"""
self.width = width
self.height = height

View file

@ -9,6 +9,11 @@ class BasicResize(object):
"""
def __init__(self, width, height):
"""
:param width: The target width, in pixels.
:param height: The target height, in pixels.
"""
self.width = width
self.height = height
@ -24,6 +29,11 @@ class Cover(object):
"""
def __init__(self, width, height):
"""
:param width: The target width, in pixels.
:param height: The target height, in pixels.
"""
self.width, self.height = width, height
def process(self, img):
@ -87,6 +97,11 @@ class SmartFill(object):
"""
def __init__(self, width, height):
"""
:param width: The target width, in pixels.
:param height: The target height, in pixels.
"""
self.width, self.height = width, height
def process(self, img):
@ -113,8 +128,8 @@ class Fit(object):
:param upscale: A boolean value specifying whether the image should
be enlarged if its dimensions are smaller than the target
dimensions.
:param mat_color: If set, the target image size will be enforced and
the specified color will be used as background color to pad the image.
:param mat_color: If set, the target image size will be enforced and the
specified color will be used as a background color to pad the image.
"""
self.width = width