2020301918-os/txttoimage.py
2022-09-22 11:32:48 +08:00

15 lines
356 B
Python

from PIL import Image
width = 520
height = 256
img = Image.new('RGB', (width,height), (255,255,255))
text = open("decrypted.txt", "r")
for i in range(250):
line = text.readline()
for j in range(510):
if line[j] == 'x':
img.putpixel((j, i), (0,0,0))
text.close()
img = img.resize((width // 2, height))
img.save('decrypted.png')