Image converters in PyRIT for vision model testing
PyRIT's image converters transform an attack prompt into an image or change an existing image, so you can see how a vision-enabled model handles text that arrives as pixels rather than as tokens. The documented image converters cover text-to-image and image-to-image transformations, and PyRIT's video converters cover image-to-video, a neighbouring capability for testing models that accept frames. Use these converters when your model or assistant reads text inside uploaded images and your input filters inspect only the text channel. In that situation, a text-only filter may never see the instruction the model reads from the picture, so the test is whether the model's own defences hold when the same request is embedded visually.
Before you design a test, decide which input path matters to your system: direct user uploads, images fetched from web pages or documents, or images produced by another tool. Each path has different preprocessing, such as resizing or recompression by the upload service, and those steps can change whether embedded text is legible to the model at all. Record the exact image pipeline you test, not only the converter settings. A converter result is a candidate input, not proof of a bypass. Whether an embedded instruction succeeded depends on the target model, its system prompt and the scorer you pair with the run, so treat a clean result as evidence only for the configuration tested. Confirm with the vendor which image formats and sizes your model accepts before choosing converter parameters.
Which image transformation fits which test question
Text embedding renders the attack text into an image so that the target model must read it visually rather than receive it as tokens. It tests whether a vision model's text filters, which are often built for typed input, still apply when instructions arrive as pixels. The question is simple: does the model act on text it reads from an image that it would refuse in plain text? Font, size, colour and background contrast decide whether the model can read the text at all, so the test measures both reading ability and refusal behaviour unless you control for legibility.
- Font and size: Small or decorative fonts can fail OCR-style reading and produce false negatives that look like defences.
- Contrast and background: Low contrast or busy backgrounds reduce legibility and make results hard to compare across runs.
- Text length: Long passages may be truncated or resized by the provider before the model sees them.
- Control images: Run the same text in plain prompts and with a legible image to separate filter behaviour from reading failure.
- Reproducibility: Record the font file, dimensions and rendering library version so reruns produce the same pixels.
Before reporting a result, confirm the exact text-embedding converter class names and their options in the PyRIT documentation for your version.
Overlay places text or an image on top of a base picture, so the attack text sits inside a natural-looking scene. It tests whether a model separates instructions embedded in visual content from the user's actual request, which is closer to how an attacker might hide text in a product photo, screenshot or scanned page. The result depends on how much the overlay competes with the underlying image, so position, opacity and scale are part of the test design rather than cosmetic details.
- Placement: Text over busy regions can be missed, and text over plain regions may be ignored by the model as decoration.
- Opacity and colour: Partial transparency tests whether the model still reads faded text, which is a useful middle case.
- Base image choice: Use base images that match the application's real input, such as documents or screenshots, so findings transfer.
- Multiple overlays: Stacking several overlays changes both legibility and difficulty, so vary one factor at a time.
- Documentation: Store the base image and overlay parameters with each result so reviewers can replay the case.
Confirm the overlay converter names and parameters in the PyRIT image converter documentation before you plan a test matrix.
Compression re-encodes the image at a lower quality, which introduces artefacts that can disrupt text recognition while leaving the text broadly visible to a person. It answers whether a defence still works after the kind of re-encoding that uploads, messaging apps and content pipelines routinely apply. If the model reads the compressed text and complies while it refused the clean version, the defence depends on pixel-level fidelity, which is a fragile control.
- Quality level: Test a range of quality settings, since a single setting shows only one point on the degradation curve.
- Format changes: Converting between lossy and lossless formats can shift artefacts in ways that matter for reading.
- Repeated encoding: Multiple passes simulate pipelines that re-compress uploads and can compound damage.
- Baseline comparison: Keep an uncompressed control so the effect of compression is isolated.
- Variability: Encoder versions and libraries can change output bytes, so pin them for comparable results.
Check the compression converter options and supported formats in the PyRIT documentation for the version you run.
Rotation and resizing change the geometry of the text, testing whether the model still reads it after tilting, mirroring or scaling. Rotation tests orientation robustness, and resizing tests how much detail the model needs. Both are useful because providers often downscale large uploads, and an attacker can exploit that step. A model that reads text at one angle or size but not another gives you a precise picture of where its visual reading breaks down.
- Angle steps: Small rotations test near-legible text, while large angles often defeat reading and show little about filters.
- Scale factors: Reduce size in steps to find the point where text stops being read, then test near that point.
- Interpolation: The resampling method changes edge quality and can alter results between libraries.
- Canvas handling: Rotation can clip corners or add borders, which may change what the model sees.
- Documented settings: Record angle, scale and resampling so the experiment can be repeated.
Confirm the rotation and resize converter names and their parameters in the PyRIT documentation before you build the test cases.
QR code generation encodes the attack text in a two-dimensional code that the model must decode from the image. It tests whether a multimodal model interprets machine-readable payloads and acts on the decoded content, a path that bypasses text reading entirely. Whether this matters depends on whether the target decodes codes at all. Test that capability first, because a model that cannot decode QR codes will not show the behaviour you are looking for, and that absence is not evidence of a defence.
- Capability check: Confirm the target can decode a benign QR code before you test a payload.
- Error correction and size: Higher error correction levels and larger modules survive distortion but carry more data, which affects the payload you can send.
- Payload content: Keep payloads representative of the threat you are modelling and label them clearly in your records.
- Combined tests: Pair QR codes with rotation, compression or overlays to see whether decoding survives realistic degradation.
- Traceability: Store the generated code image with the decoded payload and the model's response.
Confirm the QR converter class name and its options in the PyRIT documentation, and check the target's decoding behaviour in its own documentation or with your provider.
Image converter options and when each fits
This table compares the image transformation types PyRIT documents, what each changes in the input, the defence it probes and when it fits. Read each row as a hypothesis about where a vision model's text defence might fail. Before drawing conclusions, confirm the exact converter names and parameters in the PyRIT documentation for your version, and check that the transformed text is still legible to a human reviewer.
| Option | What it changes | Defence it probes | Choose it when and watch for |
|---|---|---|---|
| Text-to-image | Renders the prompt text into a new image for the model to read | Text-in-image filtering and OCR-based moderation | Choose it to check whether text-only filters miss text delivered as pixels. Font and layout choices affect legibility. |
| Image-to-image overlay | Places text on top of an existing base image | Visual reasoning and mixed text and image filtering | Choose it when realistic surrounding content matters. Base image choice can change results, so record it for each run. |
| Compression | Lowers image quality, which can blur or distort embedded text | OCR robustness in moderation pipelines | Choose it to test whether lossy artifacts stop text being read. Unreadable text may reflect the image, not a defence, so check legibility first. |
| Rotation | Changes the orientation of the image and its text | OCR and text detection that assume upright text | Choose it to test orientation sensitivity. Compare against an unrotated baseline, since many models read rotated text. |
| Resizing | Changes image dimensions, scaling text up or down | Downsampling and OCR size thresholds | Choose it to locate size limits for legibility. Resampling method can alter results, so log the settings used. |
| QR code generation | Encodes the prompt into a machine-readable QR code image | Pipelines or models that decode codes | Choose it only if the target can decode codes. Failure may reflect limited decoding ability, so confirm the target's capability first. |
| Image-to-video | Produces a video from an image through PyRIT's video converters | Video moderation and frame sampling | Choose it when the target accepts video. Confirm the converter's inputs and frame handling in the documentation before testing. |
How to set up image converter tests in PyRIT
This sequence takes a team from a clean install of PyRIT to a verified pilot run in which a multimodal target receives converted images. Each step ends with a check so that problems surface before the test set is run at volume.
Confirm a supported Python version
The engineer running the tests checks that the workstation or runner uses Python 3.10 or later but earlier than 3.15, as stated for the PyPI package. The documentation recommends Python 3.13, so use that version where your environment allows it. Create an isolated virtual environment for the test project so PyRIT's dependencies do not collide with other tooling. The step is done when the interpreter version and the environment are both recorded in the test project notes.
Install PyRIT with pip
Install the framework from PyPI with pip inside the virtual environment, then confirm the package imports cleanly in a Python session. Record the installed version, because converter names and parameters can change between releases, and the documentation for the version you install is the reference to use. Pin the version in your requirements file so every pilot run uses the same converters. The step is done when a plain import succeeds and the pinned version matches the version your team agreed to test against.
Configure the multimodal target and credentials
Point PyRIT at the vision-capable model or application you are testing. Put provider keys and endpoints in the ~/.pyrit/.env file and place runtime settings in ~/.pyrit/.pyrit_conf, keeping secrets out of notebooks and version control. Confirm with the model owner that the target accepts image input, since a text-only endpoint will silently ignore or reject the converted image. The step is done when a single text-only test prompt returns a response from the target and the credentials are not visible in any file committed to the repository.
Select and configure the image converter
Choose the image converter that matches the defence you want to test, such as text rendered into an image, overlays, compression, rotation or resizing, or QR code generation. PyRIT's image converters cover text-to-image and image-to-image transformations, so confirm the exact converter class and its parameters in the documentation for your pinned version. Set the font, size, position or other options so the rendered text stays legible to a human reviewer. The step is done when the converter instance is constructed without errors and its configuration is saved with the test plan.
Inspect converted images before the pilot
Convert a small set of known benign strings and open the output images directly, checking that the text is present, readable and not truncated. Confirm that the converted artifact is what the converter reports it produced, including its format and dimensions. Save a sample of these images with the test record so reviewers can see exactly what the target was given. The step is done when a reviewer has visually confirmed the sample images and the team agrees the transformation behaves as documented.
Run a small pilot objective set
Run a short list of objectives through the converter and target, using a deliberately small number of prompts so that any configuration fault is cheap to find. Keep a benign control objective in the set to show the pipeline returns normal responses. Review the stored conversations in PyRIT memory to see each objective, the converted input and the target reply side by side. The step is done when every pilot item produces a recorded conversation and the team has resolved any errors before scaling up.
Confirm the target receives the image input
Verify that the image actually reaches the model, not just that a reply came back. Ask the target a question whose answer depends on the image content, such as reading the text embedded in it, and check that the reply reflects that content. Compare this against a control run where the image is replaced with plain text to show a difference. Ask the model owner whether the endpoint logs or rejects image parts so that silent failures are caught. The step is done when the image-dependent answer appears in the recorded conversation and the control run behaves differently.
Scale to the full test set
Once the pilot passes, expand the objective set and run the full converter configuration, keeping the same pinned version, configuration and saved samples. Store the run settings alongside the results so the run can be repeated and explained later. Re-run the image-visibility check at the start of each larger run, because a changed endpoint or rate limit can break image delivery without an obvious error. The step is done when the full run completes and the stored records include both the test outcomes and the evidence that images were delivered.
How an objective flows through an image converter to a vision target
The flow starts with a seed objective in PyRIT's memory, which an image converter turns into an image carrying the text. The multimodal target, a model or app under test, receives that image and returns a response that is passed to a scorer. Every prompt, converted input and response is written to memory. The trust boundary marks the target as the system under test, so the operator should confirm that the converter and scorer run inside its own environment and that test traffic reaches only approved endpoints.
Objective flow from seed prompt through an image converter to the vision target and memory.
Security and operational controls for image-based red teaming
Image-based tests generate content that may be harmful, route data to hosted providers and leave records in shared memory. The controls below decide where that material lives, who can reach it and what leaves your environment during Image converters in PyRIT for vision model testing.
Storage location for generated images
Converters that create or transform images produce files that may depict harmful content, and PyRIT keeps conversations and results in its memory. Decide in advance which directory or volume holds generated images, whether it is encrypted, and who can mount it. Treat that location as restricted material, not as a scratch folder. Ask your security team to confirm the classification before the first run.
Retention and access in memory
PyRIT memory stores conversations and results in SQLite or Azure SQL, so image prompts and responses persist after a run ends unless you remove them. Define how long each test database is kept, who holds read access, and how records are deleted at the end of an engagement. Confirm the deletion procedure works on the database you actually use, not only in documentation.
Image converter docsCredentials in the environment file
PyRIT reads provider credentials from ~/.pyrit/.env, so every target's API key sits in a plain file on the machine that runs the tests. Restrict file permissions to the tester account, keep the file out of backups and source control, and rotate keys after shared use. Where your policy requires it, load secrets from a managed store instead and confirm that the setup still works with image targets.
Provider data-sharing terms
Images converted for a hosted vision model leave your environment and are processed under that provider's terms. Read the data retention, training and logging commitments for the specific service and account you use, and confirm whether any test content may be sent at all. If the content is sensitive, route testing to a self-hosted or local target instead, and document the choice.
Keeping test images out of shared logs
Application logs, CI output and chat channels often capture request payloads, and an image sent as base64 can end up in them in full. Turn off payload logging for the test harness, avoid printing image bytes to the console, and check that CI artifacts do not store generated files. Ask the platform team to confirm which log pipelines receive output from the runner.
Reporting PyRIT vulnerabilities
If testing exposes a flaw in PyRIT itself, such as an unsafe handling of image files, report it privately rather than in a public issue. The project directs vulnerability reports to the Microsoft Security Response Center under its security policy. Record the reporting path in your runbook so testers know where to send findings before they publish anything.
PyRIT on GitHubQuestions buyers ask about image converter testing
What drives the cost of image converter testing with PyRIT?
The cost is driven by how much testing is needed, not by the converters themselves. The main drivers are the number of target models and endpoints, how many converter combinations are tested (plain text in an image, overlays, compression, rotation, resizing and QR codes, alone or stacked), how the responses are scored, and how much evidence the client needs at the end. A fixed-scope quote lists each of these as a separate line so you can see what changes the price. Ask for the target count, the converter list, the scorer approach and the deliverables to be written down before work starts. DeployOpen does not publish a price list, so a quote follows from that written scope.
How long does a pilot image converter test take?
A pilot length depends on the scope agreed in writing, and no fixed duration applies to every engagement. The timeline is set by the number of targets, how quickly test access is granted, how many converter combinations are run, and how much time is needed to review scored outputs with your team. A pilot that covers one vision model and a short list of converters is usually much shorter than a multi-model program with retesting. Ask for a timeline with milestones tied to access and sign-off, so delays on your side are visible.
What does our team need to provide before testing starts?
Three things are needed before testing starts. First, access to the target model or application, usually through an API endpoint or a test deployment, with credentials handled as your security team requires. Second, a written test policy that states which content categories may be generated, which are out of bounds, and who approves changes. Third, sign-off on how harmful content is handled, including where generated images and responses are stored, who can view them, how long they are kept and how they are deleted. Without these, scoring and evidence work cannot be completed safely.
Can an in-house team run image converter tests alone?
An in-house team with Python skills and access to the target can run PyRIT's image converters, since PyRIT is open source under the MIT license and installs with pip. The harder parts are designing a scoring approach that reliably detects whether a model followed text hidden in an image, managing harmful test content safely, and turning raw runs into findings that engineers can fix. Many teams start in-house for a narrow set of converters and bring in a partner for scorer design, a defined test policy or a formal retest. Confirm the Python version your PyRIT release supports before setting up the environment.
How do image converter test results turn into findings?
Each finding should link a specific converter, a target model, the input image, the model response and the scorer's verdict. Results are grouped by converter type, such as text-in-image, overlay or QR code, so engineers can see which defence failed and under which condition. Repeated runs matter because vision models vary between calls, so a finding should state how many attempts produced the behavior. Each finding then gets a severity, a suggested fix such as input filtering, output checks or model configuration changes, and a retest after the fix is applied. Exported conversations and memory records give reviewers the trail they need to check the result.
Which parts of image converter testing need the most effort?
Scorer design and result review usually take more effort than running the converters. Converting text into an image is quick to automate, but deciding whether a vision model actually followed the hidden instruction, or only described the image, requires careful scoring rules and manual checks on a sample. Effort also grows with stacked converters, such as a rotated image with a compressed overlay, because each combination multiplies the number of runs. Ask the provider how many outputs will be checked by a person and how scorer accuracy will be measured.
Does image converter testing cover our compliance evidence needs?
Image converter testing produces records that can support a compliance review, but it does not make your system compliant or certify it. The test results, memory records, scoring method and retest history can be used as inputs to an assessment. Independent auditors and certification bodies issue any audit report or certification, and DeployOpen prepares the systems, controls and evidence those bodies review. Confirm early which frameworks your assessor expects and what format they need the evidence in.
How DeployOpen scopes image converter testing for your models
DeployOpen treats image converter testing as a defined piece of AI security work: the models, image pipelines and text-in-image cases are agreed in writing before any test runs. We set up PyRIT in an environment you control, then hand over runnable configurations, results and documentation your team can repeat.
How we scope
- Confirm which vision models, endpoints and image-handling paths are in the test boundary
- List the image converter types to test, such as text embedding, overlay, compression, rotation, resizing and QR codes
- Agree the harm objectives, datasets and success criteria in the written scope before testing starts
How we build
- Configure PyRIT targets for your vision model endpoints with credentials kept out of source files
- Build converter chains and reproducible test runs that record each image variant and model response
- Set up scoring for model responses so results can be compared across converter settings and retests
How we hand over
- Deliver runnable PyRIT configurations, converter parameters and test datasets for your own repositories
- Document findings with the image variants, prompts, responses and fixes that produced each result
- Walk your security and AI engineering teams through the run process and the retest plan
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts
- Retest agreed fixes and confirm whether the converter findings no longer reproduce
- Ongoing support, upgrades and continuous testing are available as a retainer, quoted from the written scope

