Archived:How to take a photo in m programming language on Symbian
This snippet shows how to take a photograph in m.
Note: The take function of the cam module requires Write permission if given a file path as an argument.
Images can be saved in JPEG, BMP, GIF or PNG format.
use cam, graph, ui
//Activate the camera with one of the supported resolutions
//Set the camera's brightness to slightly above normal and lower the contrast
//Display the viewfinder
cam.view(0, 0, graph.full(), graph.full())
//Set the menu and wait for the user to select the option
ui.menu("Options", ["Take photo"], false)
if ui.cmd() = "Take photo" then
//Take a picture and save it at highest quality
img = cam.take("C:\\picture.jpg", 100)
//Deactivate the camera
A photograph will be taken with the given settings and stored at the given path.
- The available resolutions can be found using the sizes function.
- The number of cameras available on a device can be found using the count constant.
- If a device has multiple cameras, the camera to be used is set using the index function that takes the camera's index as an argument.
- On some devices, maximum resolution might only be available in landscape mode.