From 17c56208ee4bfd0dfda1ed950171840cf719488f Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 28 Mar 2025 20:36:15 +0100 Subject: [PATCH] Fix camera proxy with sole image quality settings (#141676) --- homeassistant/components/proxy/camera.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/homeassistant/components/proxy/camera.py b/homeassistant/components/proxy/camera.py index f6e909f13d1..47fa9454deb 100644 --- a/homeassistant/components/proxy/camera.py +++ b/homeassistant/components/proxy/camera.py @@ -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")