Skip to content

Commit

Permalink
Update encode.py
Browse files Browse the repository at this point in the history
  • Loading branch information
itsliamdowd authored Sep 26, 2022
1 parent 77e2945 commit cd8f2ee
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import os
from PIL import Image

def encode():
image_name = input("Enter the name of the image: ")
def encodeImage():
image = Image.open(image_name)
data = input("Enter the data to encode: ")
data = data + "[ENDOFDATA]"
Expand Down Expand Up @@ -34,4 +33,9 @@ def encode():
pixels[x, y] = (red, green, blue)
image.save("encoded.png")

encode()
file_name = input("Enter the name of the file including the extension: ")
file_type = file_name.split('.')[1]
if file_type == "png":
encodeImage()
else:
print('Error')

0 comments on commit cd8f2ee

Please sign in to comment.