Created
July 5, 2015 18:54
-
-
Save ogroleg/ecbd2e6bb23bbb11c4ee 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
# -*- coding: utf-8 -*- | |
from PIL import Image | |
im = Image.open(u'07052015.png').convert('RGB') | |
pix = im.load() | |
colors_to_save = [(104, 104, 104), (114, 114, 114)] | |
w, b = (0xffffff, 0xffffff, 0xffffff), (0, 0, 0) | |
for x in range(im.size[0]): | |
for y in range(im.size[1]): | |
pix[x,y] = b if pix[x,y] in colors_to_save else w | |
im.save(u'result.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment