1
0
Fork 0
mirror of https://github.com/GeoffreyFrogeye/steginack.git synced 2024-12-21 22:30:36 +01:00

Preparations

This commit is contained in:
Geoffrey Frogeye 2015-04-23 09:06:09 +02:00
parent 9bec363107
commit 100725d05c
2 changed files with 36 additions and 0 deletions

3
.gitignore vendored
View file

@ -55,3 +55,6 @@ docs/_build/
# PyBuilder # PyBuilder
target/ target/
# Testing
*.png

33
steginack.py Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env python3
from PIL import Image
import argparse
def hideInFile(infile, hidefile, bits, outfile):
inim = Image.open(infile)
hideim = Image.open(hidefile)
assert inim.size == hideim.size, "Both image must be of the same size"
outim = Image.new('RGB', inim.size)
inim.close()
hideim.close()
outim.save(outfile, 'PNG')
def inverseFile(infile, bits, outfile):
inim = Image.open(infile)
outim = Image.new('RGB', inim.size)
inim.close()
outim.save(outfile, 'PNG')
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Hide an image inside another and decode images")
parser.add_argument('infile', metavar='INFILE', type=str, help="Input file")
parser.add_argument('bits', metavar='BITS', type=int, help="Number of bits to use")
parser.add_argument('outfile', metavar='OUTFILE', type=str, help="Output file")
parser.add_argument('-s', '--hide', type=str, help="File to hide")
args = parser.parse_args()
if args.hide:
hideInFile(args.infile, args.hide, args.bits, args.outfile)
else:
inverseFile(args.infile, args.bits, args.outfile)