Namespaces

Variants
Actions

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:Using Exif API for Symbian C++

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
Code ExampleTested with
Devices(s): Nokia N95
Compatibility
Platform(s): S60 3rd Edition, MR
S60 3rd Edition FP1
Article
Keywords: CExifRead
Created: tepaa (20 May 2008)
Last edited: lpvalente (01 Sep 2012)

Contents

Overview

The CExifRead Interface class is used for parsing the Exif v2.2 file format. With this API you can read data from JPEG images, such as date, resolution, orientation, ISO speed, and exposure time.

MMP file

The following capabilities and libraries are required:

CAPABILITY NONE
LIBRARY efsrv.lib
LIBRARY exiflib.lib

Header file

Class for reading Exif data.

#include <exifread.h>
#include <f32file.h>
 
class CMyExifReader : public CBase
{
public:
static CMyExifReader* NewL();
static CMyExifReader* NewLC();
virtual ~CMyExifReader();
private:
CMyExifReader();
void ConstructL();
public:
void ReadExifDataL(TDesC& aFilename);
 
public:
HBufC8* iImageDescription;
HBufC8* iImageDate;
 
};

Source file

CMyExifReader::CMyExifReader()
{
}
 
CMyExifReader* CMyExifReader::NewL()
{
CMyExifReader* self = NewLC();
CleanupStack::Pop();
return self;
}
 
CMyExifReader* CMyExifReader::NewLC()
{
CMyExifReader* self = new (ELeave) CMyExifReader();
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
 
void CMyExifReader::ConstructL()
{
}
 
CMyExifReader::~CMyExifReader()
{
delete iImageDescription;
delete iImageDate;
}
 
void CMyExifReader::ReadExifDataL(TDesC& aFilename)
{
// 1. Read Exif image from the file to a buffer
RFile file;
User::LeaveIfError( file.Open( CEikonEnv::Static()->FsSession(), aFilename, EFileRead ) );
CleanupClosePushL( file );
TInt size = 0;
file.Size(size);
HBufC8* exif = HBufC8::NewL( size );
CleanupStack::PushL( exif );
TPtr8 bufferDes( exif->Des() );
User::LeaveIfError( file.Read( bufferDes ) );
CleanupStack::Pop( exif );
CleanupStack::PopAndDestroy(); // file
CleanupStack::PushL( exif );
 
// 2. Instantiate Exif reader...
CExifRead* read = CExifRead::NewL( exif->Des() );
CleanupStack::PushL( read );
 
// 3. Get required data from the Exif image...
TInt err = KErrNone;
TRAP(err,iImageDescription = read->GetImageDescriptionL());
TRAP(err,iImageDate = read->GetDateTimeL());
// TODO: See CExifRead API for getting more data from image
 
// 4. Delete the reader instance...
CleanupStack::PopAndDestroy( read );
CleanupStack::PopAndDestroy( exif );
}

Postconditions

Exif data read from the given image.

See also

Exif API

File:GeoTagging Example.zip

This page was last modified on 1 September 2012, at 18:09.
59 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.

×