Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Saving an image captured using the Symbian Camera API

From Wiki
Jump to: navigation, search

Archived.pngArchived: 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}}.

Article Metadata
Tested with
Devices(s): Nokia N95 8GB
Platform(s): S60 3rd Edition, MR
S60 3rd Edition (initial release)
Platform Security
Signing Required: Self-Signed
Capabilities: UserEnvironment
Keywords: CCamera, MCameraObserver, CCamera::CaptureImage(), MCameraObserver::ImageReady(), RFile::Replace(), RFile::Write()
Created: tapiolaitinen (08 Apr 2008)
Last edited: lpvalente (11 Aug 2012)



This snippet demonstrates how to save an image which was captured using the Camera API (ecam.lib). The code is greatly simplified for the part of error handling and the actual image capturing. For more information on capturing an image, see the related code snippet Archived:Capturing an image using the Symbian Camera API.

MMP file

This snippet requires the following libraries:

LIBRARY efsrv.lib 
LIBRARY eikcore.lib

In practice, however, also the following capabilities and libraries are required (to capture an image):

CAPABILITY UserEnvironment
LIBRARY ecam.lib

Source file

#include <EIKENV.H>  // CEikonEnv
* Symbian Onboard Camera API observer. Gets called after
* CCamera::CaptureImage() is called.
* @param aBitmap a pointer to a bitmap image if this was the format specified
* @param aData a pointer to JPEG image data if this was the format specified
* @param aError KErrNone on success or an error code on failure

void CCameraEngine::ImageReady(CFbsBitmap* aBitmap, HBufC8* aData, TInt aError)
// TODO: Error handling
// It is assumed here that before capturing the image format was set
// to CCamera::EFormatExif, and that the device supports this format.
// This means that the (EXIF JPEG) image data is contained in aData
// argument.
// Connect to the file server session and reserve a file for the image
RFs& fsSession = CEikonEnv::Static()->FsSession();
_LIT(KFilename, "C:\\Data\\Images\\image.jpg");
RFile file;
TInt frErr = file.Replace(fsSession, KFilename, EFileWrite);
// TODO: Error handling
// Write the image data to the file.
TInt fwErr = file.Write(*aData);
// TODO: Error handling


The captured image is saved as C:\Data\Images\image.jpg.

See also

This page was last modified on 11 August 2012, at 18:13.
50 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.