Yash Agarwal

Oct 3, 20191 min

How to: Capture an image on a button click in Canvas Apps

In this #PowerShot, I will show you how to capture an image by clicking a button in #CanvasApps.

Step 1: Define a variable (camBtn) to control the stream rate of the camera control. This variable will be manipulated on the OnSelect property of the button control.

Expression: Set(camBtn,100)

Step 2: Assign this variable to the “Stream” property of the camera control.

Step 3: Modify the “OnStream” property of the camera control as:

Expression: Set(camBtn,0)

Step 4: The image can be retrieved on any other control (to view, save etc.) using the below expression.

Expression: Camera2.Stream

This overcomes the limitation of the camera control that enforces on capturing the image by clicking on the control window only.

I hope you found this interesting and it helped you!