要将图像文件保存,必须先获得图像的编码格式信息,但是GDI+没有直接提供这个函数:GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
因此需要我们自己写一个 GetEncoderClsid 取得图像编码格式的函数
幸好,有 GetImageDecoders函数作为参照
#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;
INT main()
{
// Initialize GDI+.
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
UINT num; // number of image decoders
UINT size; // size, in bytes, of the image decoder array
ImageCodecInfo* pImageCodecInfo;
// How many decoders are there?
// How big (in byt