Archived:Using Exif API for Symbian C++
hamishwillee
(Talk | contribs) m (Hamishwillee - Bot change of template (Template:CodeSnippet) - now using Template:ArticleMetaData) |
hamishwillee
(Talk | contribs) m (Hamishwillee - Minor update to ArticleMetaData) |
||
| Line 1: | Line 1: | ||
| + | [[Category:Symbian C++]][[Category:Code Examples]][[Category:S60 3rd Edition, Feature Pack 1]][[Category:Code Snippet]][[Category:Graphics]] | ||
__NOTOC__ | __NOTOC__ | ||
__NOEDITSECTION__ | __NOEDITSECTION__ | ||
| Line 6: | Line 7: | ||
|platform=S60 3rd Edition, MR | |platform=S60 3rd Edition, MR | ||
|devices=Nokia N95 | |devices=Nokia N95 | ||
| − | + | |creationdate=20080520 | |
| − | + | ||
| − | |creationdate= | + | |
|keywords=CExifRead | |keywords=CExifRead | ||
| − | |sourcecode= | + | |sourcecode=[[Media:GeoTagging Example.zip]] |
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) --> | |installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) --> | ||
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) --> | |sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) --> | ||
| Line 128: | Line 127: | ||
[http://library.developer.nokia.com/index.jsp?topic=/S60_3rd_Edition_Cpp_Developers_Library/GUID-CEE609D8-50E3-422D-8FF9-42C25D669E59_cover.html Exif API] | [http://library.developer.nokia.com/index.jsp?topic=/S60_3rd_Edition_Cpp_Developers_Library/GUID-CEE609D8-50E3-422D-8FF9-42C25D669E59_cover.html Exif API] | ||
| − | [[ | + | [[File:GeoTagging Example.zip]] |
| − | + | ||
| − | + | ||
Revision as of 06:34, 18 November 2011
Article Metadata
Code Example
Source file: Media:GeoTagging Example.zip
Tested with
Devices(s): Nokia N95
Compatibility
Platform(s): S60 3rd Edition, MR
Platform Security
Capabilities: )
Article
Keywords: CExifRead
Created: tepaa
(20 May 2008)
Last edited: hamishwillee
(18 Nov 2011)
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.

