mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Fix camera proxy with sole image quality settings (#141676)
This commit is contained in:
parent
b7f29c7358
commit
2a081abc18
@ -104,6 +104,15 @@ def _resize_image(image, opts):
|
|||||||
new_width = opts.max_width
|
new_width = opts.max_width
|
||||||
(old_width, old_height) = img.size
|
(old_width, old_height) = img.size
|
||||||
old_size = len(image)
|
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 old_width <= new_width:
|
||||||
if opts.quality is None:
|
if opts.quality is None:
|
||||||
_LOGGER.debug("Image is smaller-than/equal-to requested width")
|
_LOGGER.debug("Image is smaller-than/equal-to requested width")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user