Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion stegano.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from PIL import Image
import zlib
import array

import numpy as np

def image_load(infilename):
Expand Down Expand Up @@ -86,7 +89,10 @@ def decode(img):
with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum."""
# data = "lets make some dummy data"
data_binary = [np.binary_repr(ord(i), width=8) for i in data]

data_binary = bytes(data, 'utf-8')
data_binary_compressed = zlib.compress(data_binary, 9)
data_binary = ["{0:08b}".format(i) for i in data_binary_compressed]

# img_encoded = image_create(encode(img_bin, data_binary))
img_encoded = encode(img_bin, data_binary)
Expand All @@ -108,4 +114,9 @@ def decode(img):

# data_decoded = decode(image_load('./images/output-new.jpg'))
data_decoded = decode(img_ip)
data_decoded = [int(i,2) for i in data_decoded]
# print(dc)

data_decoded = array.array('B', data_decoded).tostring()
data_decoded_unompressed = zlib.decompress(data_decoded)
print(data_decoded)