mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-12 17:18:30 +02:00
Fixed steganalysis parity to be compatible with RGBA images
This commit is contained in:
parent
064456e2a3
commit
2d74094dc3
3 changed files with 10 additions and 1 deletions
|
@ -31,7 +31,7 @@ def steganalyse(img: Image.Image) -> Image.Image:
|
||||||
"""
|
"""
|
||||||
Steganlysis of the LSB technique.
|
Steganlysis of the LSB technique.
|
||||||
"""
|
"""
|
||||||
encoded: Image.Image = img.copy()
|
encoded = Image.new(img.mode, (img.size))
|
||||||
width, height = img.size
|
width, height = img.size
|
||||||
for row in range(height):
|
for row in range(height):
|
||||||
for col in range(width):
|
for col in range(width):
|
||||||
|
|
BIN
tests/expected-results/parity_rgba.png
Normal file
BIN
tests/expected-results/parity_rgba.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
|
@ -50,6 +50,15 @@ class TestSteganalysis(unittest.TestCase):
|
||||||
diff = ImageChops.difference(target, analysis).getbbox()
|
diff = ImageChops.difference(target, analysis).getbbox()
|
||||||
self.assertTrue(diff is None)
|
self.assertTrue(diff is None)
|
||||||
|
|
||||||
|
def test_parity_rgba(self):
|
||||||
|
""" Test that stegano.steganalysis.parity works with RGBA images
|
||||||
|
"""
|
||||||
|
img = Image.open('./tests/sample-files/transparent.png')
|
||||||
|
analysis = parity.steganalyse(img)
|
||||||
|
target = Image.open("./tests/expected-results/parity_rgba.png")
|
||||||
|
diff = ImageChops.difference(target, analysis).getbbox()
|
||||||
|
self.assertTrue(diff is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Add table
Reference in a new issue