高分求助:我急需一个BMP文件转gif文件的程序,哪位可以发我一个? 谢谢!

Colorstone0823 2002-07-31 04:11:57
我急需一个BMP文件转gif文件的程序,哪位可以发我一个,谢谢!
我的邮箱:cppapple@sohu.com , fu-xu@163.com
...全文
42 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
JaneQian 2002-08-01
  • 打赏
  • 举报
回复
好象在画图程序中就可以利用另存为来转换
macrotao 2002-07-31
  • 打赏
  • 举报
回复
请在google上搜索“ImageObject.lib”,这个库可以,而且很简单。但我没条件发给你,你在网上下吧。
蒋晟 2002-07-31
  • 打赏
  • 举报
回复

Platform SDK: GDI+
Retrieving the Class Identifier for an Encoder
The function GetEncoderClsid in the following example receives the MIME type of an encoder and returns the class identifier (CLSID) of that encoder. The MIME types of the encoders built into GDI+ are as follows:

image/bmp
image/jpeg
image/gif
image/tiff
image/png
The function calls GetImageEncoders to get an array of ImageCodecInfo objects. If one of the ImageCodecInfo objects in that array represents the requested encoder, the function returns the index of the ImageCodecInfo object and copies the CLSID into the variable pointed to by pClsid. If the function fails, it returns –1.

int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
{
UINT num = 0; // number of image encoders
UINT size = 0; // size of the image encoder array in bytes

ImageCodecInfo* pImageCodecInfo = NULL;

GetImageEncodersSize(&num, &size);
if(size == 0)
return -1; // Failure

pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
if(pImageCodecInfo == NULL)
return -1; // Failure

GetImageEncoders(num, size, pImageCodecInfo);

for(UINT j = 0; j < num; ++j)
{
if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
{
*pClsid = pImageCodecInfo[j].Clsid;
free(pImageCodecInfo);
return j; // Success
}
}

free(pImageCodecInfo);
return -1; // Failure
}
The following console application calls the GetEncoderClsid function to determine the CLSID of the PNG encoder:

#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;

#include "GdiplusHelperFunctions.h"

INT main()
{
// Initialize GDI+.
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

CLSID encoderClsid;
INT result;
WCHAR strGuid[39];

result = GetEncoderClsid(L"image/png", &encoderClsid);

if(result < 0)
{
printf("The PNG encoder is not installed.\n");
}
else
{
StringFromGUID2(encoderClsid, strGuid, 39);
printf("An ImageCodecInfo object representing the PNG encoder\n");
printf("was found at position %d in the array.\n", result);
wprintf(L"The CLSID of the PNG encoder is %s.\n", strGuid);
}

GdiplusShutdown(gdiplusToken);
return 0;
}
When you run the preceding console application, you get an output similar to the following:

An ImageCodecInfo object representing the PNG encoder
was found at position 4 in the array.
The CLSID of the PNG encoder is {557CF406-1A04-11D3-9A73-0000F81EF32E}.
Platform SDK: GDI+
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 function

INT 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;
}


Colorstone0823 2002-07-31
  • 打赏
  • 举报
回复
我需要的是自己编程序实现这个转换
极速小王子 2002-07-31
  • 打赏
  • 举报
回复
如果有源程序,请给我一份!谢谢!
lilachue@etang.com
LocalVar 2002-07-31
  • 打赏
  • 举报
回复
用acdsee4.0

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧