Created
May 1, 2021 18:45
-
-
Save alanwsmith/c72539123bc8009f85d56147b0cead85 to your computer and use it in GitHub Desktop.
working on twixel cleanup with PIL
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
from PIL import Image | |
with Image.open('image-2021-05-01T13-10-39-0400.png') as im: | |
img = Image.new('RGB', (1000, 1000), color = 'white') | |
px = im.load() | |
for x in range(301, 309): | |
for y in range(61, 67): | |
print(f"{x}, {y} - {px[x, y]}") | |
img.putpixel((x, y), px[x, y]) | |
# for x in range(300, 450): | |
# for y in range(57, 170): | |
# # print(f"{x}, {y} - {px[x, y]}") | |
# img.putpixel((x, y), px[x, y]) | |
# | |
# for x in range(0, im.width, 10): | |
# x_pull = x + 3 | |
# for y in range(0, im.height, 10): | |
# y_pull = y + 3 | |
# # print(f'{x_pull}, {y_pull}') | |
# red, green, blue = px[x, y] | |
# | |
# #if red > 245 and red < 252 and green > 153 and < 161: | |
# | |
# if 230 <= red <= 255 and 135 <= green <= 175 and 60 <= blue <= 95: | |
# x_put = int(x_pull / 10) | |
# y_put = int(y_pull / 10) | |
# img.putpixel((x_put, y_put), (0, 0, 0)) | |
# print(f'{x_pull}, {y_pull}') | |
# | |
# | |
# # for y in range(0, im.height): | |
# # print(f'{x} {y}') | |
# # #red, green, blue = px[x, y] | |
# | |
# | |
# img.putpixel((20, 20), (255, 255, 255)) | |
img.save('bars.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment