Modifies reddit's image cropping algorithm to accept an image of any dimension to produce a square thumbnail. This is sometimes referred to as smart-cropping.
Produces an NxN-sized thumbnail of an image without distortion. For example, a 100px x 50px image can be converted to a 25px x 25px thumbnail. First, the 100x50 will be cropped to 50x50, then reduced to 25x25. The cropping algorithm works by calculating the entropy of an image and slicing off the side that has the least entropy.
You'll need PIL installed to modify images. http://www.pythonware.com/products/pil/
from PIL import Image
import pycrop as pc
im = Image.open(path_to_file)
image = pc.prepare_image(im, (200,200))
image.save(new_filename, 'JPEG')
Takes a PIL Image object and a tuple of the dimensions.