jdriscoll/django-imagekit — pull request #66 by matthewwithanm (2011-11-16 05:22:14+00:00)
Title: My Attempt at a Trim Processor

Believe it or not, a project I'm working on required a trim processor so, with @fish2000's #61 fresh in my mind, I took a crack at writing one. Obviously, we hadn't quite settled on an API, so I decided to commit this to my fork and issue a pull request to give us all a place to discuss it.

Here are the highlights:

* Named `TrimColor`
* Resides in a new "crop" module (@fish2000 put his in "resize", but resize is really a misnomer—"scale" is more accurate)
* Accepts a PIL color—generally, an RGBA 4-tuple (`(255, 255, 255, 255)` is white.) though other formats may work
* a `tolerance` argument
* a `sides` argument lets you limit the sides that will be trimmed
* border color automatically detected if not provided

Feedback on (and patches for!) the implementation is welcome, but getting the right API is priority number one.

If you want to see what @fish2000, @chrisdrackett and I have discussed so far, please check out #61.