Skip to content

Instantly share code, notes, and snippets.

@sljeff
Created February 23, 2017 12:19
Show Gist options
  • Save sljeff/262db0f738fc732fa92403846d47eef9 to your computer and use it in GitHub Desktop.
Save sljeff/262db0f738fc732fa92403846d47eef9 to your computer and use it in GitHub Desktop.
from PIL import Image
img = Image.open("QQwhite.jpg")
width, height = img.size
result = Image.new('RGB', (width, height))
data = list(img.getdata())
for i, t in enumerate(data):
if set(t) == {255}:
data[i] = (0, 0, 0)
result.putdata(data)
result.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment