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.

Saving Symbian bitmap images to files

From Wiki
Jump to: navigation, search
Article Metadata
Created: symbianyucca (23 Mar 2007)
Last edited: hamishwillee (20 Sep 2013)


The CJpgSaver example class illustrates a simplified image saver with which you can save Symbian bitmap images into the JPG files. With this example image saving is implemented by using CImageEncoder::FileNewL() - Api, for saving the bitmap to other types of image files, you could change the MIME type constant used with the FileNewL().

CImageEncoder also allows saving images to buffers, to change this example to save images to buffers, just change the FileNewL() to be DataNewL() and supply modifiable buffer into the function instead of the filename.

You could also save images to MBM files by using the Save() function defined in CFbsBitmap, note that this function only saves one image to a file, thus you can not have multiple images in the MBM when using this function.

You could also save Symbian bitmap images into the stores for more information, see Saving settings with Dictionary store


#include <f32file.h>
#include <e32std.h>
#include <gdi.h>
#include <ImageConversion.h>
#include <coemain.h>
class MImageSavedCallBack
virtual void ImageSavedL(const TInt& aError) = 0;
class CJpgSaver : public CActive
static CJpgSaver* NewL(CFbsBitmap& aBitmap,const TDesC& aFileName,MImageSavedCallBack& aCallBack);
virtual ~CJpgSaver();
void DoCancel() ;
void RunL() ;
CJpgSaver(CFbsBitmap& aBitmap,MImageSavedCallBack& aCallBack);
void ConstructL(const TDesC& aFileName);
private: //data
CFbsBitmap& iBitmap;
MImageSavedCallBack& iCallBack;
CImageEncoder* iEncoder;


CJpgSaver* CJpgSaver::NewL(CFbsBitmap& aBitmap,const TDesC& aFileName,MImageSavedCallBack& aCallBack)
CJpgSaver* self = new (ELeave) CJpgSaver(aBitmap,aCallBack);
CleanupStack::PushL( self );
return self;
delete iEncoder;
CJpgSaver::CJpgSaver(CFbsBitmap& aBitmap,MImageSavedCallBack& aCallBack)
void CJpgSaver::ConstructL(const TDesC& aFileName)
CActiveScheduler::Add( this );
iEncoder = CImageEncoder::FileNewL(CCoeEnv::Static()->FsSession(),aFileName, KMimeType);
iEncoder->Convert( &iStatus, iBitmap);
void CJpgSaver::DoCancel()
void CJpgSaver::RunL()
This page was last modified on 20 September 2013, at 00:45.
71 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.