Files
pyDefis/L'écharpe de Mme Weasley.py
2022-10-16 18:03:42 +02:00

25 lines
547 B
Python

from PIL import Image
image = Image.open("L'écharpe de Mme Weasley.png")
#image = Image.open("L'écharpe de Mme Weasley_exemple.png")
block = 8
width, height = image.size
xmax = width // block
ymax = height // block
res = ""
for x in range(xmax):
for y in range(ymax):
colors = {}
for i in range(block):
for j in range(block):
pixel = image.getpixel((x*block+i,y*block+j))
colors[pixel] = None
res = res + f"{len(colors)-1:1X}"
print(bytearray.fromhex(res).decode())