利用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 你可能也喜欢 [运维] CentOS8创建桥接网络 log4j2 不使用配置文件,动态生成logger对象 利用elasticsearch alias和reindex操作实现服务零停机迁移 String类实验练习 Altium Designer16 总结之六:输出贴片坐标文件、装配文件,结构文件 判断文件重复上传 hgame –Classic Childhood Game(web) USB描述符(附加USB HID报告描述符 ) Ubuntu16.04上安装配置PCL1.7.2 字符设备驱动(1)代码分析—之gpio_get_value HTML table标签固定高度,并且显示滚动条 跟读者聊 Goroutine 泄露的 N 种方法,真刺激! Spring 线程池的使用和配置 在线词云图生成(以WordArt为例) 【2. Nginx高级知识】 【numpy】几种fft函数的使用 Kotlin偏函数 前端也有必要了解JWT吗? springboot 并发执行定时任务 STM32单片机初学5-IIC通信驱动OLED屏幕