Added a unit test for steganlysis-parity

This commit is contained in:
AdrienCos 2019-06-06 21:45:15 -04:00
parent e4784ad04d
commit 064456e2a3
No known key found for this signature in database
GPG key ID: 97AD9AEBCA16D08D
3 changed files with 61 additions and 6 deletions

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Stegano - Stegano is a basic Python Steganography module.
# Copyright (C) 2010-2019 Cédric Bonhomme - https://www.cedricbonhomme.org
@ -26,16 +26,16 @@ __license__ = "GPLv3"
from PIL import Image
def steganalyse(img):
def steganalyse(img: Image.Image) -> Image.Image:
"""
Steganlysis of the LSB technique.
"""
encoded = img.copy()
encoded: Image.Image = img.copy()
width, height = img.size
bits = ""
for row in range(height):
for col in range(width):
r, g, b = img.getpixel((col, row))
r, g, b = img.getpixel((col, row))[0:3]
if r % 2 == 0:
r = 0
else:
@ -48,5 +48,5 @@ def steganalyse(img):
b = 0
else:
b = 255
encoded.putpixel((col, row), (r, g , b))
encoded.putpixel((col, row), (r, g, b))
return encoded