From d59c974151df62821b770a02df41e6f34415fb7e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 23 Aug 2021 12:36:26 -0500 Subject: [PATCH] Adjust camera docs to provide clarity on how to handle aspect ratios (#1037) * Adjust camera docs to provide clarity on how to handle aspect ratios - When working on home-assistant/frontend#9690 with `bramkragten`, we discovered we need a minimum width and height to ensure the frontend images remain crisp and the docs were not clear on what do to when aspect ratios were not the same. * Update docs/core/entity/camera.md Co-authored-by: Paulus Schoutsen --- docs/core/entity/camera.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/core/entity/camera.md b/docs/core/entity/camera.md index da889002..2930ae4b 100644 --- a/docs/core/entity/camera.md +++ b/docs/core/entity/camera.md @@ -26,9 +26,11 @@ Properties should always only return information from memory and not do I/O (lik When the width and height are passed, scaling should be done on a best-effort basis. The UI will fall back to scaling at the display layer if scaling cannot be done by the camera. -- Integrations should pass on the width and height if the underlying camera is capable of scaling the image. +- Return the smallest image that meets the minimum width and minimum height. -- Integrations may choose to ignore the height parameter to preserve the aspect ratio. +- When scaling the image, aspect ratio must be preserved. If the aspect ratio is not the same as the requsted height or width, it is expected that the width and/or height of the returned image will be larger than requested. + +- Pass on the width and height if the underlying camera is capable of scaling the image. - If the integration cannot scale the image and returns a jpeg image, it will automatically be scaled by the camera integration when requested.