64 GdiplusStartupInput gdiplusStartupInput;
65 ULONG_PTR gdiplusToken;
66 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput,
nullptr);
69 GetImageEncodersSize(&encoderNum, &encoderSize);
70 vector<char> codec_buffer(encoderSize);
71 ImageCodecInfo *codecs = (ImageCodecInfo *)&codec_buffer.front();
72 GetImageEncoders(encoderNum, encoderSize, codecs);
73 for (UINT i = 0; i < encoderNum; ++i)
74 if (memcmp(&(
format_id[
format]), &codecs[i].FormatID,
sizeof(GUID)) == 0) {
75 bitmap.Save(stream, &codecs[i].Clsid,
nullptr);