Fix camera proxy with sole image quality settings (#141676)

This commit is contained in:
Franck Nijhof 2025-03-28 20:36:15 +01:00
parent b7f29c7358
commit 2a081abc18
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -104,6 +104,15 @@ def _resize_image(image, opts):
new_width = opts.max_width
(old_width, old_height) = img.size
old_size = len(image)
# If no max_width specified, only apply quality changes if requested
if new_width is None:
if opts.quality is None:
return image
imgbuf = io.BytesIO()
img.save(imgbuf, "JPEG", optimize=True, quality=quality)
return imgbuf.getvalue()
if old_width <= new_width:
if opts.quality is None:
_LOGGER.debug("Image is smaller-than/equal-to requested width")