Crop image based on pixel color

Scott Rossi scott at tactilemedia.com
Sat Oct 29 16:07:06 EDT 2005


Recently, Roger.E.Eller at sealedair.com  wrote:

> Imagine a jpg or png image (any format really) that has white space all
> around the image. What would be the most efficient way to sample the
> colors (quickly) and determine a rect that can be used to crop the image?
> Has this been done before? Got scripts?

If you could guarantee that that the space around the image was *truly*
white (or some other solid color) and the images were not huge then this
*might* be possible to some extent.  However, many images, most notably
JPEGs, can have color variations in the white space due to compression,
which makes this a tough thing for Rev to do natively if you want it done
fast.  The other issue is, if the white space is irregular, then you
basically need to sample virtually every point around image, looking for
non-white-space color changes.  Again, I might be wrong but I think this
would be hard to do natively if it needs to be fast.

I know Chipp Walters of Altuit was working with some kind of Photoshop-like
algorithms or libraries -- maybe he has some insight.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com




More information about the use-livecode mailing list