AnthenaMatrix / Image-Prompt-Injection

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.
https://anthenamatrix.com
19 stars 13 forks source link

IndexError: string index out of range #1

Open christianbaumann opened 3 months ago

christianbaumann commented 3 months ago

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"

cat.jpg: cat

sajjad-salam commented 3 months ago

try with png image