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

This commit is contained in:
Franck Nijhof
2025-03-28 20:36:15 +01:00
committed by GitHub
parent 8474d9fefe
commit 17c56208ee

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")