Is there a straightforward way to use PIL to trim off the borders of an
image?

I'm thinking of something equivalent to the trim() function in ImageMagick.
It looks at the 4 corner pixels, figures out what color the border is, and
then trims out rows and columns from the image's edges that match the border
color.  So, as a use case, you could upload an image with some arbitrary
amount of whitespace around the main content of the image, and trim out all
that extra space.

I don't see any equivalent built-in functionality in the PIL documentation
-- crop() seems to come closest but it lacks the extra logic needed.  I'm
not opposed to writing the logic myself, but I'd like to avoid reinventing
the wheel, if I can. :)

Thanks for any ideas you can provide.
_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to