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)
def test_parity(self): """Test stegano.steganalysis.parity""" text_file_to_hide = "./tests/sample-files/lorem_ipsum.txt" with open(text_file_to_hide) as f: message = f.read() secret = lsb.hide("./tests/sample-files/Lenna.png", message) analysis = parity.steganalyse(secret) target = Image.open("./tests/expected-results/parity.png") diff = ImageChops.difference(target, analysis).getbbox() self.assertTrue(diff is None)
def main(): parser = argparse.ArgumentParser(prog='stegano-steganalysis-parity') parser.add_argument("-i", "--input", dest="input_image_file", required=True, help="Input image file.") parser.add_argument("-o", "--output", dest="output_image_file", required=True, help="Output image file.") arguments = parser.parse_args() input_image_file = Image.open(arguments.input_image_file) output_image = parity.steganalyse(input_image_file) output_image.save(arguments.output_image_file)