2 nouveaux défis
This commit is contained in:
122
La machine temporelle à rotations.py
Normal file
122
La machine temporelle à rotations.py
Normal file
@@ -0,0 +1,122 @@
|
||||
from PIL import Image
|
||||
|
||||
#exemple input = "carre_base_encode.png"
|
||||
input = "tentacle_image_encode_4.png"
|
||||
|
||||
imagette1_noir = [
|
||||
[
|
||||
[0,255,0,0],
|
||||
[0,255,255,255],
|
||||
[255,255,255,0],
|
||||
[0,0,255,0],
|
||||
],
|
||||
[
|
||||
[0,255,255,255],
|
||||
[255,255,255,0],
|
||||
[0,0,255,0],
|
||||
[0,255,0,0],
|
||||
],
|
||||
[
|
||||
[255,255,255,0],
|
||||
[0,0,255,0],
|
||||
[0,255,0,0],
|
||||
[0,255,255,255],
|
||||
],
|
||||
[
|
||||
[0,0,255,0],
|
||||
[0,255,0,0],
|
||||
[0,255,255,255],
|
||||
[255,255,255,0],
|
||||
],
|
||||
[
|
||||
[255,0,0,0],
|
||||
[255,255,255,0],
|
||||
[255,255,0,255],
|
||||
[0,255,0,0],
|
||||
],
|
||||
[
|
||||
[0,0,0,255],
|
||||
[255,255,0,255],
|
||||
[255,0,255,255],
|
||||
[255,0,0,0],
|
||||
],
|
||||
[
|
||||
[0,0,255,0],
|
||||
[255,0,255,255],
|
||||
[0,255,255,255],
|
||||
[0,0,0,255],
|
||||
],
|
||||
]
|
||||
imagette2_noir = [
|
||||
[
|
||||
[0,0,255,0],
|
||||
[255,255,255,0],
|
||||
[0,255,255,255],
|
||||
[0,255,0,0],
|
||||
],
|
||||
[
|
||||
[255,255,255,0],
|
||||
[0,255,255,255],
|
||||
[0,255,0,0],
|
||||
[0,0,255,0],
|
||||
],
|
||||
[
|
||||
[0,255,255,255],
|
||||
[0,255,0,0],
|
||||
[0,0,255,0],
|
||||
[255,255,255,0],
|
||||
],
|
||||
[
|
||||
[0,255,0,0],
|
||||
[0,0,255,0],
|
||||
[255,255,255,0],
|
||||
[0,255,255,255],
|
||||
],
|
||||
[
|
||||
[0,255,0,0],
|
||||
[255,255,0,255],
|
||||
[255,255,255,0],
|
||||
[255,0,0,0],
|
||||
],
|
||||
[
|
||||
[255,0,0,0],
|
||||
[255,0,255,255],
|
||||
[255,255,0,255],
|
||||
[0,0,0,255],
|
||||
],
|
||||
[
|
||||
[0,0,0,255],
|
||||
[0,255,255,255],
|
||||
[255,0,255,255],
|
||||
[0,0,255,255],
|
||||
],
|
||||
]
|
||||
|
||||
noir = imagette1_noir + imagette2_noir
|
||||
|
||||
input_image = Image.open(input)
|
||||
width, height = input_image.size
|
||||
|
||||
output_image = Image.new(input_image.mode, (int(width)//4, int(height)//4))
|
||||
|
||||
for x in range(0, width, 4):
|
||||
for y in range(0, height, 4):
|
||||
if x == 4 and y == 4:
|
||||
z=1
|
||||
imagette = [
|
||||
[input_image.getpixel((x, y)), input_image.getpixel((x+1, y)), input_image.getpixel((x+2, y)), input_image.getpixel((x+3, y))],
|
||||
[input_image.getpixel((x, y+1)), input_image.getpixel((x+1, y+1)), input_image.getpixel((x+2, y+1)), input_image.getpixel((x+3, y+1))],
|
||||
[input_image.getpixel((x, y+2)), input_image.getpixel((x+1, y+2)), input_image.getpixel((x+2, y+2)), input_image.getpixel((x+3, y+2))],
|
||||
[input_image.getpixel((x, y+3)), input_image.getpixel((x+1, y+3)), input_image.getpixel((x+2, y+3)), input_image.getpixel((x+3, y+3))],
|
||||
]
|
||||
|
||||
if imagette in noir:
|
||||
output_image.putpixel((x//4, y//4), 0)
|
||||
# print("NOIR", imagette)
|
||||
else:
|
||||
output_image.putpixel((x//4, y//4), 1)
|
||||
# print("BLANC", imagette)
|
||||
|
||||
output_image.show()
|
||||
|
||||
"Tux", "Gnu", "Beastie", "Adiumy"
|
||||
36
Les écailles du dragon....py
Normal file
36
Les écailles du dragon....py
Normal file
@@ -0,0 +1,36 @@
|
||||
from PIL import Image
|
||||
from operator import xor
|
||||
|
||||
input = "dungeons_portal_enc.png"
|
||||
|
||||
input_image = Image.open(input)
|
||||
width, height = input_image.size
|
||||
|
||||
sample_size = 50
|
||||
offset = 400
|
||||
# output_image = Image.new(input_image.mode, (int(sample_size), int(sample_size)))
|
||||
# for N in range(0,256):
|
||||
# for x in range(offset, offset+sample_size):
|
||||
# for y in range(offset, offset+sample_size):
|
||||
# pixel = input_image.getpixel((x,y))
|
||||
# if xor((x**3+y**7)%256, N)%256 == pixel:
|
||||
# output_image.putpixel((x-offset,y-offset), 0)
|
||||
# else:
|
||||
# output_image.putpixel((x-offset,y-offset), 255)
|
||||
|
||||
# output_image.save(f"d_{N:04}.png")
|
||||
|
||||
#==>N semble valoir 7
|
||||
|
||||
N = 7
|
||||
output_image = Image.new(input_image.mode, (int(width), int(height)))
|
||||
|
||||
for x in range(width):
|
||||
for y in range(height):
|
||||
pixel = input_image.getpixel((x,y))
|
||||
if xor((x**3+y**7)%256, N)%256 == pixel:
|
||||
output_image.putpixel((x,y), 0)
|
||||
else:
|
||||
output_image.putpixel((x,y), 255)
|
||||
|
||||
output_image.show()
|
||||
BIN
carre_base_encode.png
Normal file
BIN
carre_base_encode.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 948 B |
BIN
dungeons_portal_enc.png
Normal file
BIN
dungeons_portal_enc.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
BIN
tentacle_image_encode_4.png
Normal file
BIN
tentacle_image_encode_4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 803 KiB |
Reference in New Issue
Block a user