Skip to content

Instantly share code, notes, and snippets.

@riklomas
Created May 19, 2009 18:43
Show Gist options
  • Save riklomas/114311 to your computer and use it in GitHub Desktop.
Save riklomas/114311 to your computer and use it in GitHub Desktop.
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