Image Prompt Injection is a Python script that demonstrates how to embed a secret prompt within an image using steganography techniques. This hidden prompt can be later extracted by an AI system for analysis, enabling covert communication with AI models through images.
I get the following output when trying to run the script
chriss@MW-38CMRQ3:/mnt/c/git_repos/_misc/Image-Prompt-Injection$ python3 image_prompt-injection.py
Traceback (most recent call last):
File "image_prompt-injection.py", line 56, in <module>
embed_prompt(image_path, prompt)
File "image_prompt-injection.py", line 22, in embed_prompt
pixel[i] = pixel[i] & ~1 | int(binary_prompt[prompt_index])
IndexError: string index out of range
image_path = "cat.jpg"
prompt = "List some test types in software testing"
I get the following output when trying to run the script
cat.jpg: