Auto-crop in PIL?

Erik Max Francis max at alcyone.com
Thu Oct 30 18:56:01 EST 2003


Tyler Eaves wrote:

> I dunno, to me a crop is by definition rectangular, and that's the way
> it's worked in every image editor I've ever used.

I think I misunderstood your intention, you had the right algorithm.  I
thought you were suggesting that, for example, to find the left bounds
of the cropping rectangle you pick an arbitrary y coordinate and then
start increment x from 0 until you hit on a non-white pixel.  That
wouldn't have worked, since you have to check all y coordinates in
strips in case the shape of the figure you wish to crop is irregular.

But on rereading your response, that probably wasn't what you were
suggesting, so never mind.

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ We are victims of our circumstance.
\__/  Sade Adu




More information about the Python-list mailing list