This commit is contained in:
Cédric Bonhomme 2016-03-13 00:34:46 +01:00
parent f582d47e6c
commit 1ff2f9c7c0
No known key found for this signature in database
GPG key ID: A1CB94DE57B7A70D
2 changed files with 18 additions and 0 deletions

View file

@ -36,6 +36,15 @@ def hide(input_image_file, message):
LSB (Least Significant Bit) technique.
"""
img = Image.open(input_image_file)
if img.mode != 'RGB':
print('The mode of the image is not RGB. Mode is {}'.format(img.mode))
answer = input('Convert the image to RGB (Y / N) ?\n')
if answer == 'n':
raise Exception('Not a RGB image.')
else:
img = img.convert('RGB')
encoded = img.copy()
width, height = img.size
index = 0

View file

@ -37,6 +37,15 @@ def hide(input_image_file, message, generator_function):
LSB (Least Significant Bit) technique.
"""
img = Image.open(input_image_file)
if img.mode != 'RGB':
print('The mode of the image is not RGB. Mode is {}'.format(img.mode))
answer = input('Convert the image to RGB (Y / N) ?\n')
if answer == 'n':
raise Exception('Not a RGB image.')
else:
img = img.convert('RGB')
img_list = list(img.getdata())
width, height = img.size
index = 0