Archived:How to take a photo in m programming language on Symbian
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
M on Symbian is not maintained and may not run on current Symbian versions. All M articles have been archived.
M on Symbian is not maintained and may not run on current Symbian versions. All M articles have been archived.
Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90
Compatibility
Platform(s): S60 2nd Edition, S60 3rd Edition, S60 5th Edition
Platform Security
Capabilities: )
Article
Created: bogdan.galiceanu
(05 May 2009)
Last edited: hamishwillee
(09 May 2013)
Contents |
Overview
This snippet shows how to take a photograph in m.
Preconditions
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.
Source code
use cam, graph, ui
//Activate the camera with one of the supported resolutions
cam.on(0)
//Set the camera's brightness to slightly above normal and lower the contrast
cam.bright(15)
cam.contrast(-10)
//Display the viewfinder
cam.view(0, 0, graph.full()[0], graph.full()[1])
//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)
end
//Deactivate the camera
cam.off()
Postconditions
A photograph will be taken with the given settings and stored at the given path.
Additional information
- 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.


(no comments yet)