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 18:22, 8 October 2008.

CS000864 - Displaying image information

From Forum Nokia Wiki



ID CS000864 Creation date March 28, 2008
Platform S60 3rd Edition, MR
S60 3rd Edition, FP1
S60 3rd Edition, FP2 Beta
Tested on devices Nokia E61i
Nokia E90 Communicator
Nokia N95 8GB
Category Symbian C++ Subcategory Imaging


Keywords (APIs, classes, methods, functions): CFrameInfoStrings, CImageDecoder::FileNewL(), CImageDecoder::FrameInfoStringsL()

Overview

This code snippet demonstrates how to obtain and display the following information about an image:

  • Decoder
  • Format
  • Dimensions
  • Color depth
  • Details

MMP file

The following libraries are required:

LIBRARY  imageconversion.lib

Header file

/**
 * Obtains the image info
 * @param aFs a reference to the file server session
 * @param aFilename the filename of the image
 * @return image info as CFrameInfoStrings*
 */
CFrameInfoStrings* CApp::GetImageInfoL(RFs& aFs, const HBufC& aFilename);

Source file

#include <ImageConversion.h>
 
const TInt KMaxInfoDescriptorLength = 80;
// Obtains the image info from the image referenced by the aFilename
CFrameInfoStrings* CApp::GetImageInfoL(RFs& aFs, const HBufC& aFilename)
    {
    CImageDecoder* decoder = CImageDecoder::FileNewL(aFs, aFilename);
    CleanupStack::PushL(decoder);
    CFrameInfoStrings* info = decoder->FrameInfoStringsL();
    CleanupStack::PopAndDestroy(decoder);
    return info;
    }
// Connect a client process to the fileserver
RFs fsSession;
User::LeaveIfError(fsSession.Connect());
CleanupClosePushL(fsSession);
 
// Obtain the image info
_LIT(KLITFilename, "C:\\Data\\Images\\image.jpg");
const HBufC* KFilename = KLITFilename().Alloc();
CFrameInfoStrings* info = GetImageInfoL(fsSession, *KFilename);
CleanupStack::PushL(info);
 
// Display the info items one by one
for (TInt i = 0; i < info->Count(); i++)
    {
    TBuf<KMaxInfoDescriptorLength> infoItem;
    infoItem.Append(info->String(i));
    CAknInformationNote* note = new (ELeave) CAknInformationNote(ETrue);
    note->ExecuteLD(infoItem);
    }
 
// Clean up
CleanupStack::PopAndDestroy(2);  // info, fsSession
fsSession.Close();

Postconditions

Image information is displayed.

Related Discussions
Thread Thread Starter Forum Replies Last Post
Unable to open mp3 files directly. satish3k Mobile Java Media (Graphics & Sounds) 7 2007-05-30 11:35
Observing incoming call kannabiran.k General Symbian C++ 11 2008-08-26 09:36
Cut an image antonio5982 Mobile Java Media (Graphics & Sounds) 6 2007-09-20 11:17
want to hide the MIDlet name in the application lakshmanraob Mobile Java Tools & SDKs 2 2005-08-16 06:58
Live Video Display and Camera Server Timeouts simonplatt General Symbian C++ 2 2007-08-16 12:09
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX