解决方案 »
- 今天查容器错误,头晕了,搞不清楚星期几了
- ADO+Access如何获得Recordset的结构信息
- 如何包LPCTSTR类型转换成CString类型呢
- 请教使用ODBC编程实现VC与SQL server 数据库的连接并操作其数据的方法
- 关于动态产生文档、视图、框架的疑惑!
- 如何用ShellExecute执行一个内部命令
- SDK的简单问题,求教
- 如何在程序中动态的生成一个数据库
- 如何将unicode转换为中文
- (新手问题)为何我下载了VC例子在ResurceView中看不到该Dialog。
- 怎样watch list<CMyObj> _list中的元素?
- 预览的时候显示的是汉字,可是在打印的时候却是乱码,怎么回事啊
http://expert.csdn.net/Expert/topic/2481/2481713.xml?temp=.2874567
Converting a BMP Image to a PNG Image
To save an image to a disk file, call the Save method of the Image class. The following console application loads a BMP image from a disk file, converts the image to the PNG format, and saves the converted image to a new disk file. The main function relies on the helper function GetEncoderClsid, which is shown in Retrieving the Class Identifier for an Encoder.#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;INT GetEncoderClsid(const WCHAR* format, CLSID* pClsid); // helper functionINT main()
{
// Initialize GDI+.
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); CLSID encoderClsid;
Status stat;
Image* image = new Image(L"Bird.bmp"); // Get the CLSID of the PNG encoder.
GetEncoderClsid(L"image/png", &encoderClsid); stat = image->Save(L"Bird.png", &encoderClsid, NULL); if(stat == Ok)
printf("Bird.png was saved successfully\n");
else
printf("Failure: stat = %d\n", stat); delete image;
GdiplusShutdown(gdiplusToken);
return 0;
}