Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 10:07, 20 May 2008.

CS000968 - Using Exif API

From Forum Nokia Wiki


ID CS000968 Creation date May 20, 2008
Platform S60 3rd Edition, MR Tested on devices Nokia N95
Category Symbian C++ Subcategory Graphics


Keywords (APIs, classes, methods, functions): CExifRead

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

Image:GeoTagging Example.zip

Related Discussions
Thread Thread Starter Forum Replies Last Post
listRoots does not work on s60 emulator desijatt Mobile Java General 6 2007-02-02 16:25
Calendar API access for older that 3rd edition? nhammond General Symbian C++ 1 2007-03-13 13:58
How to get auto start programs list on 3rd jobe159 General Symbian C++ 11 2008-07-29 06:07
Old wishlist thread - feature requests now tracked in SourceForge eriksmartt Python 90 2006-03-09 13:46
About API Performance fuu2525 Bluetooth Technology 0 2004-11-08 08:24
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX