Repository navigation
FEAT: Add ImageBlurConverter (Gaussian blur) - #4433
Merged
Roman Lutz (romanlutz) merged 7 commits intoNov 24, 2026
Merged
Roman Lutz (romanlutz) merged 7 commits into
Roman Lutz (romanlutz) merged 7 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
RGB PNGs with color-key transparency bypass alpha-aware blurring, allowing hidden colors to bleed into visible pixels and leaving alpha edges unblurred.
1 open issue
What changed in this PR
Adds ImageBlurConverter to PyRIT’s image converter stack for testing multimodal robustness to Gaussian blur, addressing #4398.
Changes:
- Implements configurable blur with radius validation, size preservation, and premultiplied-alpha handling.
- Exports the converter through the lazy-loading public API.
- Adds unit tests, a usage example, and a converter-table entry.
| File | Description |
|---|---|
tests/unit/converter/test_image_blur_converter.py |
Tests validation, blur behavior, image modes, transparency, and input handling. |
pyrit/converter/image_blur_converter.py |
Implements Gaussian blur and parameter identification. |
pyrit/converter/__init__.py |
Adds the public lazy export and typing import. |
doc/code/converters/3_image_converters.py |
Adds a blur usage example. |
doc/code/converters/0_converters.ipynb |
Lists the converter’s supported input and output types. |
Review effort: Balanced
…add _async to async test names
An RGB image with a transparent color key now becomes RGBA inside _convert_to_rgb_or_rgba, so every image converter gets an alpha channel its transform cannot silently drop, instead of each subclass promoting it separately. ImageBlurConverter's local promotion is removed; its color-key test now covers the shared path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Roman Lutz (romanlutz)
approved these changes
Nov 23, 2026
Contributor
Author
|
Thanks for the review, for moving the colour-key handling into the base class, and for the merge, Roman Lutz (@romanlutz). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Adds
ImageBlurConverter, which applies a Gaussian blur to an image to check whether a target still reads, and image-based filtering still catches, text rendered into a blurred image. Closes #4398.BaseImageToImageConverterand usesImageFilter.GaussianBlur(radius);radius(default2.0) must be finite and greater than 0, otherwiseValueError. The size is preserved.RGBa). A plain RGBA blur mixes the hidden color of fully transparent pixels into the visible edge (a transparent red area next to opaque blue gives a purple fringe), and there is a test for this.pyrit.converter, with a section in3_image_convertersafterImageResizingConverter, and the converter table in0_convertersupdated.This and #4432 (for #4399) both add a row to the
0_converterstable, so whichever lands second will need a rebase there. I'll take care of it.