mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-13 01:18:31 +02:00
Closes #2.
This commit is contained in:
parent
f582d47e6c
commit
1ff2f9c7c0
2 changed files with 18 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue