5 nouveaux défis

This commit is contained in:
2022-10-16 18:03:42 +02:00
parent 5d8d6dd6ee
commit 00331e1249
9 changed files with 147 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
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())