调用ImageConvert函数即可,测试代码在http://download.csdn.net/detail/qq1134993111/6227899
ImageConverter.h
/*
转换图片格式 GDI+支持的格式
*/
#pragma once
#include <wtypes.h>
#include <guiddef.h>
#include <string>
using namespace std;
#include <GdiPlus.h>
using namespace Gdiplus;
#pragma comment(lib,"gdiplus")
//获取format对应类型的图片解码器的CLSID
int GetEncoderClsid(const WCHAR* format, CLSID* pClsid);
/*
wstrImageSrcPath 源图片文件全路径(包括扩展名)
wstrImageDesPath 转换后文件存放全路径(包括括展名)
wstrFormatType 转换参数,例如:L"image/png" 、L"image/bmp" 等等。要和wstrImageDesPath路径中的图像格式一样
返回值为true表示成功
*/
bool ImageConvert(wstring wstrImageSrcPath,wstring wstrImageDesPath,wstring wstrFormatType);
ImageConverter.cpp
#include "ImageConverter.h"
int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
{
UINT num = 0; /