From 62be3fbb8cae77998e16f46f9b52c174e6f7081e Mon Sep 17 00:00:00 2001 From: pliny <133052465+elder-plinius@users.noreply.github.com> Date: Sat, 12 Oct 2024 18:31:57 -0400 Subject: [PATCH] Update app.py --- app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 3aa4076..f5dab52 100644 --- a/app.py +++ b/app.py @@ -19,9 +19,9 @@ def encode_text_into_image(image_path, text, output_path): img = Image.open(image_path) img = img.convert("RGBA") # Ensure image has alpha channel - # Convert text to binary + # Convert text to binary and repeat the text to improve robustness binary_text = ''.join(format(ord(char), '08b') for char in text) + '00000000' # Add terminator - repeated_binary_text = binary_text * 10 # Increase redundancy by repeating the message 10 times + repeated_binary_text = binary_text * 10 # Embed the message 10 times for redundancy width, height = img.size pixel_count = width * height