Camera.aspect readonly

Controls how the live camera preview is scaled inside the Camera widget. Accepted values are:

  • "stretch": the camera image is stretched to fill the entire widget area, ignoring the original aspect ratio
  • "4x3": the image is letterboxed horizontally to preserve a 4:3 aspect ratio
  • "16x9": the image is letterboxed vertically to preserve a 16:9 aspect ratio

Example

--! luart-extensions import ui, capture local win = ui.Window("Camera", "fixed", 640, 520) local cam = ui.Camera(win, 10, 10, 620, 460) -- Switch to 16:9 letterbox mode cam.aspect = "16x9" print("Current aspect mode: "..cam.aspect) await win:showasync()