Friday, October 10, 2008

GDI+

I am kind of new to windows programming with Visual C++. I was required to generate thumbnails of image files for different formats for a project. I searched the net and found a lot of free libraries but all of them seemed to require format-specific libraries to be included with them. This means if you want to support PNG format, you will have to include libpng, if you want to support JPEG, you will need to include libjpeg, and so on. Then I found out that there is a library called GDI+ which comes with Windows XP/2003. It has encoders and decoders for many common formats. It has many advanced built-in routines to facilitate graphics manipulation. It even has a separate method called GetThumbnailImage for generating thumbnails! It worked fine for me. I also needed to save an HICON as an image file. I was able to do it using the Bitmap class of GDI+, which has a constructor that takes an HICON as parameter.
I had to add gdiplus.lib to the Additional Dependencies in Linker Input.

No comments: