Describe the bug
ImageResizingConverter accepts positive scale factors that can truncate the output width or height to 0, causing Pillow to raise ValueError: height and width must be > 0. It also accepts non-finite values such as nan and inf.
Steps/Code to Reproduce
from PIL import Image
from pyrit.prompt_converter import ImageResizingConverter
ImageResizingConverter(scale_factor=0.5)._apply_transform(
Image.new("RGB", (1, 1))
Fix
Reject non-finite scale factors and raise a clear ValueError before calling Pillow when either calculated dimension is below one pixel.
I would like to submit a focused fix with unit tests.
@romanlutz
Describe the bug
ImageResizingConverteraccepts positive scale factors that can truncate the output width or height to0, causing Pillow to raiseValueError: height and width must be > 0. It also accepts non-finite values such asnanandinf.Steps/Code to Reproduce
Fix
Reject non-finite scale factors and raise a clear ValueError before calling Pillow when either calculated dimension is below one pixel.
I would like to submit a focused fix with unit tests.
@romanlutz