views:

324

answers:

1

Hi, do you have a working code to share.

I’m trying to figure out how to save to a file an IBitmapImage image.

I need to resize existing .jpg file and it seems like the only API for Windows Mobile. I managed to load it convert it to IImage -> IBitmapImage -> IBasicBitmapOps and resize it finally, but I have no clue how to save it properly to a new file.

+1  A: 

Use IBitmapImage::LockBits to get access to the image data via its BitmapData* lockedBitmapData parameter. Use the BitmapData to prepare a bitmap file info header, then write that one and the image data in BitmapData::Scan0 to a file using regular file writing with ::WriteFile or higher level ones if you use such.

Johann Gerell
thanks, but is it possible to save this image as jpg
michael
This example seems to do what you want: http://www.koders.com/cpp/fid743B2B2FCDBFE91584C329A50766C1155709DA1B.aspx
Johann Gerell