Created
June 23, 2020 11:31
-
-
Save omargourari/7c177261c72b28e2a1ef1a943b7c100d 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
#!/usr/bin/python3 | |
import os | |
from PIL import Image | |
def change_color(image): | |
if not image.startswith('.') and len(os.path.basename(image)) < 18: | |
picture = Image.open(image) | |
w, h = picture.size | |
pixels = picture.load() | |
for x in range(w): | |
for y in range(h): | |
current_color = picture.getpixel((x, y)) | |
(r, g, b, o) = current_color | |
if 153 <= r <= 252: | |
pixels[x, y] = (255, 255, 255, 255) | |
os.remove(image) | |
picture.save(image) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment