The message is encoded in base 64.

This commit is contained in:
cedricbonhomme 2011-03-24 09:15:32 +01:00
parent 203060ac81
commit a31e2f1f81

View file

@ -26,12 +26,12 @@ __license__ = "GPLv3"
# Thanks to: http://www.julesberman.info/spec2img.htm
def hide(img, img_enc, copyright="http://bitbucket.org/cedricbonhomme/stegano"):
"""
"""
import shutil
import datetime
import zlib.compress
from base64 import b64encode
from exif.minimal_exif_writer import MinimalExifWriter
@ -39,7 +39,7 @@ def hide(img, img_enc, copyright="http://bitbucket.org/cedricbonhomme/stegano"):
text = "\nImage annotation date: "
text = text + str(datetime.date.today())
text = text + "\nImage description:\n"
text = b64encode(text + file.read())
text = zlib.compress(b64encode(text + file.read()))
file.close()
try:
@ -59,13 +59,14 @@ def reveal(img):
"""
"""
from base64 import b64decode
import zlib.decompress
from exif.minimal_exif_reader import MinimalExifReader
try:
g = MinimalExifReader(img)
except:
print("Impossible to read description.")
return
print(b64decode(g.imageDescription()))
print(zlib.decompress(b64decode(g.imageDescription())))
print(("\nCopyright " + g.copyright()))
#print g.dateTimeOriginal()s