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.
Using CImageEncoder class we can save images originating from the screen and photos from camera, etc. to files or descriptors. This process is in two stages:
Creation of encoder object is synchronous operation and is performed using the constructors FileNewL() or DataNewL().
The FileNewL() constructor is used when converting image data that is to be saved to file. And DataNewL() constructor is used when converting image data that is to be saved to descriptor.
Before converting image data, we need to the destination image format specific data using CFrameImageData. And using Convert() method we can convert the image to destination image format. Following is the code snippet for convert the image
TJpegImageData * imageData = new (ELeave) TJpegImageData;
// Set some format specific data
imageData->iSampleScheme = TJpegImageData::EColor444;
imageData->iQualityFactor = 95;
iFrameImageData = CFrameImageData::NewL();
// frameData - ownership passed to iFrameImageData after AppendImageData
// Do the convert
iEncoder->Convert(iRequesStatus,iFrameBitmap,(const CFrameImageData*) iFrameImageData);
// Note: the convert function is asynchronous.
// If you use descriptor as target for convertion, call the SetActive()
// after iEncoder->Convert() and catch the end of convertion with RunL()
// (i.e. use the CActive stuff)