How to save bitmap with image.save()?

I have bitmap in memory and would like to save it with image::save, but I cannot find how to do it. The example on MSDN uses image object created from file.

http://msdn.microsoft.com/en-us/library/ms535407%28v=vs.85%29.aspx

Is it even possible, or it is useless for the bitmap?

1
2
3
4
5
CLSID pngClsid;
GetEncoderClsid(L"image/png", &pngClsid);
// some code to initiate Image object and get the bitmap there
// then to save it
Image.Save(L"Mosaic2.png", &pngClsid, NULL);
What is the error? Does the compiler refuse your code? Does the execution crash, or does it just do something unexpected?
I cannot find out if is it even possible to use this image class to save the bitmap to file. MSDN described how to create image object from file and how to save it to file with image class/instance. So what I have now is function to detect MIME type. I did not Image class initiation. When I look on the methods supported by image class I see http://msdn.microsoft.com/en-us/library/ms534462%28v=vs.85%29.aspx
1
2
Image::Image(IStream*,BOOL) 	
Creates an Image::Image object based on a stream.

So this is for files. No support for bitmap input argument.

The error which I get while using no instance is:
Gdiplus::Image::Save' : illegal call of non-static member function

Does GDI or GDI+ have support for saving bitmap to file or possibly even converting to different MIME type?

Edit:
I originally looked for function GdipSaveImageToFile which is called by dll call in AHK. That is used to save to file. However this redirected me to image.save()
Last edited on
I cannot find any bitmap class method to save the image to file
The Bitmap class inherits from the Image class, hence all Image function are available for Bitmap too.
Topic archived. No new replies allowed.