利用GDI+图片格式转换(例如BMP转PNG) Post author:xfxia Post published:2023年9月5日 Post category:其他 主要是先探测目标图片的编码器 然后在把数据以相应的编码存储起来。 如下为 BMP转PNG的 做法. #include <windows.h> #include <gdiplus.h> #include <stdio.h> using namespace Gdiplus; //探测PNG编码器的CLSID 函数 int GetEncoderClsid(const WCHAR* format, CLSID* pClsid); int main() { // 初使化 GDI+. GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); CLSID encoderClsid; Status stat; Image* image = new Image(L”图片1.bmp”); // 探测PNG编码器的CLSID GetEncoderClsid(L”image/png”, &encoderClsid); stat = image->Save(L”图片1.png”, &encoderClsid, NULL); if(stat == Ok) printf(“成功!/n”); else printf(“失败: 错误码: %d/n”, stat); delete image; GdiplusShutdown(gdiplusToken); return 0; } int GetEncoderClsid(const WCHAR* format, CLSID* pClsid) { UINT num 版权声明:本文为clodfront原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 原文链接:https://blog.csdn.net/clodfront/article/details/5489761 你可能也喜欢 Ocelot简易教程(五)之集成IdentityServer认证以及授权 递归序列化错误:Recursive Serialization is not supported. You can‘t dereference a PPtr while loading. JDBC连接数据库——对数据库表增删改查 AngularJS中$http服务的简单用法 XMLConfiguration 的使用 ES(2)基本使用 ubuntu16.04下YOLO V3的训练,测试识别图片中的目标和实时摄像头中的目标 C语言中signal函数简介及使用 MVC、MVCS、MTV、MVP框架模式 使用SharpZip压缩与解压缩的实战经验 为什么char*的指针变量,通过strlen(&p)计算出的数是随机值 Oracle 11g的安装 组成原理(学习整理目录树) 漂亮的div css tab springboot中定义拦截器的两种方式 升序数组中查找两个数,使得它们的和正好是输入的那个数字 SDNUOJ 1681.easy problem Ⅱ 抽象工厂对产品等级的拓展(求大神指点) Android中使用kotlin协程 【Nacos学习】三、Nacos作为配置中心