Add option to either pass a path or an Image instance

This commit is contained in:
Peter Justin 2019-04-08 09:57:50 +02:00
parent 538316c722
commit 93de151025
5 changed files with 27 additions and 8 deletions

View file

@ -42,7 +42,7 @@ def hide(input_image: Union[str, IO[bytes]],
message_length = len(message)
assert message_length != 0, "message length is zero"
img = Image.open(input_image)
img = tools.open_image(input_image)
if img.mode not in ['RGB', 'RGBA']:
if not auto_convert_rgb:
@ -96,7 +96,7 @@ def hide(input_image: Union[str, IO[bytes]],
def reveal(input_image: Union[str, IO[bytes]], encoding='UTF-8'):
"""Find a message in an image (with the LSB technique).
"""
img = Image.open(input_image)
img = tools.open_image(input_image)
width, height = img.size
buff, count = 0, 0
bitab = []