0

So, I want to save an HBITMAP to different image file formats like BMP,PNG and JPEG. I believe that the most simple way to do it is by using GDI+. So here is what I came up with.

Gdiplus::Bitmap bmp(hbmpImage,(HPALETTE)0);
CLSID pngClsid;
GetEncoderClsid(L"image/png", &pngClsid);
bmp.Save(L"D:\image.png",&pngClsid,NULL);

The problem is that it doesn't work, and I get a bunch of errors "error LNK2019: unresolved external symbol". I got GetEncoderClsid() function from MSDN, but I don't believe that this is the problem. Probably it's something else something I'm missing or something I don't know.
I tried to do it the old way but I got lost in all those file headers and info headers, and I can't find any understandable info about how to use them.

I would really appreciate any help.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by raptr_dflo
0

Your error message indicates that you're not linking your executable against whatever library contains the compiled implementation code for GetEncoderClsid(). Go back to the documentation on MSDN, there's probably something there that tells you what library you need to specify in your Build set-up.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.