diff --git a/La machine temporelle à rotations.py b/La machine temporelle à rotations.py new file mode 100644 index 0000000..0130223 --- /dev/null +++ b/La machine temporelle à rotations.py @@ -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" \ No newline at end of file diff --git a/Les écailles du dragon....py b/Les écailles du dragon....py new file mode 100644 index 0000000..1dc8ef3 --- /dev/null +++ b/Les écailles du dragon....py @@ -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() diff --git a/carre_base_encode.png b/carre_base_encode.png new file mode 100644 index 0000000..a560ba8 Binary files /dev/null and b/carre_base_encode.png differ diff --git a/dungeons_portal_enc.png b/dungeons_portal_enc.png new file mode 100644 index 0000000..bce8478 Binary files /dev/null and b/dungeons_portal_enc.png differ diff --git a/tentacle_image_encode_4.png b/tentacle_image_encode_4.png new file mode 100644 index 0000000..11779c0 Binary files /dev/null and b/tentacle_image_encode_4.png differ