Detect whether an image has a white border?
Posted: 2011-11-02T09:06:00-07:00
I'm trying to write a script to detect whether an image has a white border, and, if so, apply a black border around it.
Doing a bit of research in the forum as to how to get the color value of a pixel, I found this:
http://www.imagemagick.org/Usage/quantize/#extract
My initial attempt would be to write a script that got the pixel dimensions of the image, then use these dimensions to iterate through each pixel around the entire border and determine whether it is white. But I'm wondering if there is a smarter/faster way to do this kind of analysis on an image?
Any suggestions?
Doing a bit of research in the forum as to how to get the color value of a pixel, I found this:
http://www.imagemagick.org/Usage/quantize/#extract
My initial attempt would be to write a script that got the pixel dimensions of the image, then use these dimensions to iterate through each pixel around the entire border and determine whether it is white. But I'm wondering if there is a smarter/faster way to do this kind of analysis on an image?
Any suggestions?