Created
May 19, 2009 18:43
-
-
Save riklomas/114311 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Image | |
def borders(filename): | |
im = Image.open(filename) | |
im = im.convert("RGB") | |
pix = im.load() | |
x = im.size[0]-1 | |
y = im.size[1]-1 | |
if pix[0, 0] == pix[x, y] and pix[x, 0] == pix[0, y] and pix[x, 0] == pix[x, y]: | |
return '#%02x%02x%02x' % pix[0, 0] | |
else: | |
return '#ffffff' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment