# encoding=utf-8 from PIL import Image def getlsb(f1, f2): tmp = Image.open(f1) w, h = tmp.size cnt = 0 data = "" for height in range(0, h): for weight in range(0, w): pixel = tmp.getpixel((weight, height)) # 处理三通道(RGB) if cnt % 3 == 0: cnt += 1 data += str((int(pixel[0]) % 2)) if cnt % 3 == 1: cnt += 1 data += str((int(pixel[1]) % 2)) if cnt % 3 == 2: cnt += 1 data += str((int(pixel[2]) % 2)) with open(f2, "wb") as file: for i in range(0, len(data), 8): t = int(data[i: i + 8], 2) file.write(chr(t)) t = "" file.close() for i in range(1, 423): filename = str("frames_" + str(i).zfill(5) + ".png") new = filename output = str("output_" + str(i).zfill(5) + ".txt") out = output getlsb(new, out)
from PIL import Image from zlib import * MAX = 29 pic = Image.new("RGB",(MAX,MAX)) str ="1111111010011110010010111111110000010011001100001101000001101110100010111100111010111011011101000001100011010101110110111010010100100011001011101100000100010110001001010000011111111010101010101010111111100000000101101101001000000000110110100111000101011010000011101110111001001101110011110001100111001101110110110011000101010010111101111001100110111111001111011011001101110001110001101010001010000101111001011010111111111100011001001011100110111110011101001111010110001110100001111001110001001111000001111101111110101100001101101110010111011101111000111011101101011100000000000101111100110000101001011111111010000000010100101101110001010011111110001010010101101011100100000100100001001001000100001011101011100111001111111001010111010111010110111100101001101110100100001100010000100111000001010101111100101111110111111110110110010000100010000" i=0 for y in range(0,MAX): for x in range(0,MAX): if(str[i] == '1'): pic.putpixel([x,y],(0,0,0)) else:pic.putpixel([x,y],(255,255,255)) i = i+1 pic.show() pic.save("flag.png")