×
Namespaces

Variants
Actions
Revision as of 05:49, 23 April 2012 by hamishwillee (Talk | contribs)

Archived:How to take a photo in m programming language on Symbian

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90
Compatibility
Platform(s): S60 2nd Edition, S60 3rd Edition, S60 5th Edition
Symbian
S60 5th Edition
Platform Security
Capabilities: )
Article
Keywords: cam
Created: bogdan.galiceanu (05 May 2009)
Last edited: hamishwillee (23 Apr 2012)

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.
46 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×