Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanwsmith/c72539123bc8009f85d56147b0cead85 to your computer and use it in GitHub Desktop.
Save alanwsmith/c72539123bc8009f85d56147b0cead85 to your computer and use it in GitHub Desktop.
working on twixel cleanup with PIL
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