Skip to content

Instantly share code, notes, and snippets.

@keewon
Created March 8, 2016 08:45
Show Gist options
  • Save keewon/94be0f4f508f30739a37 to your computer and use it in GitHub Desktop.
Save keewon/94be0f4f508f30739a37 to your computer and use it in GitHub Desktop.
from PIL import Image
im = Image.open("ic_notify.png")
out = Image.new("RGBA", (96, 96))
pix = out.load()
blank = (0, 0, 0, 0)
white = (255, 255, 255, 255)
for x in range(0, 96):
for y in range(0, 96):
p = im.getpixel((x,y))
if p[0] > 200 and p[1] > 200 and p[2] > 200:
pix[x, y] = blank
else:
pix[x, y] = white
out.save("test.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment