×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Using Exif API for Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search
Forum Nokia KB (Talk | contribs)
Forum Nokia KB (Talk | contribs)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
__NOEDITSECTION__
 
__NOEDITSECTION__
 
+
{{KBCS}}
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"  
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"  
 
|-
 
|-
|'''ID''' ||
+
|'''ID''' ||CS000968
|'''Creation date''' || May 12, 2008
+
|'''Creation date''' || May 20, 2008
 
|-
 
|-
 
|'''Platform''' || S60 3rd Edition, MR
 
|'''Platform''' || S60 3rd Edition, MR
Line 11: Line 11:
 
|-
 
|-
 
|'''Category''' || Symbian C++
 
|'''Category''' || Symbian C++
|'''Subcategory''' ||  
+
|'''Subcategory''' || Graphics
 
|-
 
|-
 
|}
 
|}
Line 22: Line 22:
  
 
==Overview==
 
==Overview==
CExifRead Interface class for parsing Exif v2.2 file format.  
+
The CExifRead Interface class is used for parsing the Exif v2.2 file format.  
Via this API you can read data from JPEG images e.g. date, resolution,
+
With this API you can read data from JPEG images, such as date, resolution,
orientation, ISO speed, exposure time...
+
orientation, ISO speed, and exposure time.
  
 
==MMP file==
 
==MMP file==
Line 124: Line 124:
  
 
==Postconditions==  
 
==Postconditions==  
Exif data readed from given image.
+
Exif data read from the given image.
  
 
==See also==
 
==See also==
 
[http://www.forum.nokia.com/document/CDL_Extension_S60_3rd_Ed_FP2/GUID-C89505CF-D5FE-4C89-95D4-692443563021/html/Exif_API4.html Exif API]
 
[http://www.forum.nokia.com/document/CDL_Extension_S60_3rd_Ed_FP2/GUID-C89505CF-D5FE-4C89-95D4-692443563021/html/Exif_API4.html Exif API]
  
[http://wiki.forum.nokia.com/index.php/Image:GeoTagging_Example.zip GeoTagging_Example.zip]
+
[[Image:GeoTagging Example.zip]]
  
[[Category:Symbian C++]][[Category:Code Examples]]
+
[[Category:Symbian C++]][[Category:Code Examples]][[Category:S60 3rd Edition, Feature Pack 1]]

Revision as of 13:07, 20 May 2008


Template:KBCS

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

File:GeoTagging Example.zip

153 page views in the last 30 days.
×