Unfortunately, you can't run this in the browser here
This program reads from the filesystem, so it must be run locally — it cannot run in the browser.
Run python main.py in a directory that contains at least
one image file.
Description
View the source code
from PIL import Image
photo_name = "photo.png"
message = "This is a secret!"
img = Image.open(photo_name)
pixels = img.load()
width,height = img.size
x,y = 0,0
for i in range(len(message)):
r,g,b = pixels[x,y]
char = ord(message[i])
new_b = (b&~1) | (char & 1)
pixels[x,y] = (r,g,new_b)
x += 1
if x >= width:
x = 0
y += 1
if y >= height:
break
img.save(photo_name)
print(f"Message hidden in {photo_name}")
Previous Day
Next Day