哪位有BMP<->Jpg,Gif,Pcx等的源代码?

zjy 2002-07-22 10:50:10
哪位有BMP<->Jpg,Gif,Pcx等的源代码?
我的信箱:jiyezhao@sina.com.cn
谢谢!
...全文
105 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
yhb4 2002-07-22
  • 打赏
  • 举报
回复
up
kkk16 2002-07-22
  • 打赏
  • 举报
回复
http://www.codeguru.com
http://www.codeproject.com
storein 2002-07-22
  • 打赏
  • 举报
回复
我有BMP<--->JPEG的程序。
是采用intel JPEG library

要的话,给我发邮件

digitalwatermark@163.com
zhuang094 2002-07-22
  • 打赏
  • 举报
回复
建议你去找《Visual C++.net图象处理编程》这本书看看。
kimryo 2002-07-22
  • 打赏
  • 举报
回复
我有...

不过不是你想像的那种方法。。。
wistaria 2002-07-22
  • 打赏
  • 举报
回复
http://www.paintlib.de/paintlib/
paintlib is a portable C++ class library for image loading, saving and manipulation. Images can be loaded from BMP, GIF, JPEG, PCX, PGM, PICT, PNG, TGA, TIFF and WMF files and saved in BMP, JPEG, PNG and TIFF formats. (copyrighted open source software)
wistaria 2002-07-22
  • 打赏
  • 举报
回复
http://www.paintlib.de/paintlib/
paintlib is a portable C++ class library for image loading, saving and manipulation. Images can be loaded from BMP, GIF, JPEG, PCX, PGM, PICT, PNG, TGA, TIFF and WMF files and saved in BMP, JPEG, PNG and TIFF formats. (copyrighted open source software)
masterz 2002-07-22
  • 打赏
  • 举报
回复
convert BMP->JPG via GDI+
#include <Stdio.h>
#include <Objbase.h>
#include <Windows.h>
#include <Gdiplus.h>
#include <GdiPlusEnums.h>
using namespace Gdiplus;
#pragma comment(lib,"gdiplus")
// Helper functions
int GetCodecClsid(const WCHAR*, CLSID*);

int main()
{
CLSID codecClsid;
EncoderParameters encoderParameters;
long quality;
Status stat;
GdiplusStartupInput gdiplusStartupInput;
ULONG gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
{
// Get an image from the disk.
Image image(L"F:\\ddd.bmp");

// Get the CLSID of the JPEG codec.
GetCodecClsid(L"image/jpeg", &codecClsid);

// Before we call Image::Save, we must initialize an
// EncoderParameters object. The EncoderParameters object
// has an array of EncoderParameter objects. In this
// case, there is only one EncoderParameter object in the array.
// The one EncoderParameter object has an array of values.
// In this case, there is only one value (of type LONG)
// in the array. We will set this value to 0, 50, and 100.

encoderParameters.Count = 1;
encoderParameters.Parameter[0].Guid = EncoderQuality;
encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong;
encoderParameters.Parameter[0].NumberOfValues = 1;

// Save the image as a JPEG with quality level 0.
quality = 0;
encoderParameters.Parameter[0].Value = &quality;
stat = image.Save(L"Shapes001.jpg", &codecClsid, &encoderParameters);

if(stat == Ok)
wprintf(L"%s saved successfully.\n", L"Shapes001.jpg");
else
wprintf(L"%d Attempt to save %s failed.\n", stat, L"Shapes001.jpg");

// Save the image as a JPEG with quality level 50.
quality = 50;
encoderParameters.Parameter[0].Value = &quality;
stat = image.Save(L"Shapes050.jpg", &codecClsid, &encoderParameters);

if(stat == Ok)
wprintf(L"%s saved successfully.\n", L"Shapes050.jpg");
else
wprintf(L"%d Attempt to save %s failed.\n", stat, L"Shapes050.jpg");

// Save the image as a JPEG with quality level 100.
quality = 100;
encoderParameters.Parameter[0].Value = &quality;
stat = image.Save(L"Shapes100.jpg", &codecClsid, &encoderParameters);

if(stat == Ok)
wprintf(L"%s saved successfully.\n", L"Shapes100.jpg");
else
wprintf(L"%d Attempt to save %s failed.\n", stat, L"Shapes100.jpg");
}
GdiplusShutdown(gdiplusToken);
return 0;
} // main
int GetCodecClsid(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(int j = 0; j < num; ++j)
{
if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
{
*pClsid = pImageCodecInfo[j].Clsid;
return j; // Success
}
} // for

return -1; // Failure

} // GetCodecClsid
//download gdiplus.dll
//http://www.microsoft.com/downloads/release.asp?releaseid=32738
//Platform SDK Redistributable: GDI+ RTM
masterz 2002-07-22
  • 打赏
  • 举报
回复
convert image to GIF via GDI+
#include <Stdio.h>
#include <Objbase.h>
#include <Windows.h>
#include <Gdiplus.h>
#include <GdiPlusEnums.h>
using namespace Gdiplus;
#pragma comment(lib,"gdiplus")
int GetCodecClsid(const WCHAR*, CLSID*);
HRESULT __fastcall AnsiToUnicode(LPCSTR pszA, LPOLESTR* ppszW)
{
ULONG cCharacters;
DWORD dwError;
if (NULL == pszA)
{
*ppszW = NULL;
return NOERROR;
}
cCharacters = strlen(pszA)+1;
*ppszW = (LPOLESTR) CoTaskMemAlloc(cCharacters*2);
if (NULL == *ppszW)
return E_OUTOFMEMORY;
if (0 == MultiByteToWideChar(CP_ACP, 0, pszA, cCharacters,*ppszW, cCharacters))
{
dwError = GetLastError();
CoTaskMemFree(*ppszW);
*ppszW = NULL;
return HRESULT_FROM_WIN32(dwError);
}
return NOERROR;
}

int main(int argc, char* argv[])
{
int n_ret=0;
printf("%s can convert jpg, png, gif, tiff to gif file.\n if it works, it is written by masterz, otherwise I don't know who write it\n",argv[0]);
if(argc!=3)
{
printf("usage:%s gif_filename source_image_filename\n",argv[0]);
return -1;
}
GdiplusStartupInput gdiplusStartupInput;
ULONG gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
{
CLSID codecClsid;
Status stat;
EncoderParameters encoderParameters;

GetCodecClsid(L"image/gif", &codecClsid);
encoderParameters.Count = 0;
LPOLESTR bstr_src_img;
LPOLESTR bstr_dst_fn;
AnsiToUnicode(argv[1],&bstr_dst_fn);
AnsiToUnicode(argv[2],&bstr_src_img);
Image image(bstr_src_img);
stat =image.Save(bstr_dst_fn, &codecClsid, &encoderParameters);
if(stat == Ok)
{
n_ret=0;
wprintf(L"%s saved successfully.\n",bstr_dst_fn);
}
else
{
n_ret=-2;
wprintf(L"%d Attempt to save %s failed.\n", stat, bstr_dst_fn);
}
CoTaskMemFree(bstr_dst_fn);
CoTaskMemFree(bstr_src_img);
}
GdiplusShutdown(gdiplusToken);
return 0;
} // main
int GetCodecClsid(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;
return j; // Success
}
} // for

return -1; // Failure

} // GetCodecClsid
//in order to compile this program, you need to download microsoft platform sdk from http://www.microsoft.com/msdownload/platformsdk/sdkupdate/downlevel.htm
//also download gdiplus.dll and put it at the same directory as the executable.
//http://www.microsoft.com/downloads/release.asp?releaseid=32738
//Platform SDK Redistributable: GDI+ RTM
masterz 2002-07-22
  • 打赏
  • 举报
回复
#include <Stdio.h>
#include <Objbase.h>
#include <Windows.h>
#include <Gdiplus.h>
#include <GdiPlusEnums.h>
using namespace Gdiplus;
#pragma comment(lib,"gdiplus")
// Helper functions
int GetCodecClsid(const WCHAR*, CLSID*);
HRESULT __fastcall AnsiToUnicode(LPCSTR pszA, LPOLESTR* ppszW)
{
ULONG cCharacters;
DWORD dwError;
if (NULL == pszA)
{
*ppszW = NULL;
return NOERROR;
}
cCharacters = strlen(pszA)+1;
*ppszW = (LPOLESTR) CoTaskMemAlloc(cCharacters*2);
if (NULL == *ppszW)
return E_OUTOFMEMORY;
if (0 == MultiByteToWideChar(CP_ACP, 0, pszA, cCharacters,*ppszW, cCharacters))
{
dwError = GetLastError();
CoTaskMemFree(*ppszW);
*ppszW = NULL;
return HRESULT_FROM_WIN32(dwError);
}

return NOERROR;
}


int main(int argc, char* argv[])
{
int n_ret=0;
printf("%s can convert jpg, png, gif, tiff to bmp file.\n if it works, it is written by masterz, otherwise I don't know who write it",argv[0]);
if(argc!=3)
{
printf("usage:%s bmp_filename source_image_filename\n",argv[0]);
return -1;
}
GdiplusStartupInput gdiplusStartupInput;
ULONG gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
{
CLSID codecClsid;
Status stat;
EncoderParameters encoderParameters;

GetCodecClsid(L"image/bmp", &codecClsid);
encoderParameters.Count = 0;
LPOLESTR bstr_src_img;
LPOLESTR bstr_dst_bmp;
AnsiToUnicode(argv[1],&bstr_dst_bmp);
AnsiToUnicode(argv[2],&bstr_src_img);
Image image(bstr_src_img);
stat =image.Save(bstr_dst_bmp, &codecClsid, &encoderParameters);
if(stat == Ok)
{
n_ret=0;
wprintf(L"%s saved successfully.\n",bstr_dst_bmp);
}
else
{
n_ret=-2;
wprintf(L"%d Attempt to save %s failed.\n", stat, bstr_dst_bmp);
}
CoTaskMemFree(bstr_dst_bmp);
CoTaskMemFree(bstr_src_img);
}
GdiplusShutdown(gdiplusToken);
return 0;
} // main
int GetCodecClsid(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;
return j; // Success
}
} // for

return -1; // Failure

} // GetCodecClsid
//in order to compile this program, you need to download microsoft platform sdk from http://www.microsoft.com/msdownload/platformsdk/sdkupdate/downlevel.htm
//also download gdiplus.dll and put it at the same directory as the executable.
//http://www.microsoft.com/downloads/release.asp?releaseid=32738
//Platform SDK Redistributable: GDI+ RTM
1,bmp_in.zip
在多文档客户区中增加位图底图演示程序(59KB)
2,bmp_in2.zip
在多文档客户区中增加位图底图(27KB)
3,bitmap_ocx.zip
一个自适应大小的位图控件(3KB)
4,bitmap_ocx2.zip
一个自适应大小的位图控件演示程序(21KB)
5,dashline.zip
一个简单的虚线类(46KB)
6,rotatedc2.zip
旋转你的图形-高级内存设备描述表演示程序(49KB)
7,rotatedc.zip
旋转你的图形-高级内存设备描述表(21KB)
8,jtdraw.zip
JTDraw -- 一个绘画的例子(165KB)
9,autofont.zip
自动字体处理类(3KB)
10,colorapp.zip
CColor - 在一个类中包括了RGB和HLS设定可执行程序(10KB)
11,colorapp2.zip
CColor - 在一个类中包括了RGB和HLS设定(20KB)
12,jpeg.zip
操作JPEG的库和源程序(390KB)
13,dibimage.zip
这个例子功能强大,能够以多种方式处理位图文件,强烈推荐 COOL(112KB)
14,ssbase.zip
屏幕保护程序基类(27KB)
15,quiz_scr.zip
十分简单的屏幕保护程序(32KB)
16,gpslib.zip
在你的应用程序中添加对GPS(全球定位系统)的支持,提供的DLL可被其它开发软件所利用(83KB)
17,throw.zip
平抛运动演示程序(40.8k VC 作者:添翼虎)(41KB)
18,dodib.zip
处理位图的例子(112KB)
19,ampuisrc.zip
类似于WinAMP的图形界面(50KB)
20,Gray.zip
一个基于DirectX的图象灰度处理示例,可是MMX的新作了(57KB)
21,Screen.zip
一个基于DirectX的截图示例,又是MMX的新作^o^,你看懂了话都能截图了(14KB)
22,opengl1.zip
OpenGL三维图形程序设计(539kb)
23,wingrap.zip
Windows图形编程(189kb)
24,Graphics.zip
VC图形编程的一个简单工程<1450kb>
25,DIBShow.zip
设备无关位图的一个里例子<1830kb>
26,Clock.zip
一个数字时钟的图形的工程<1450kb>
27,PAINTOBJ.zip
一个类似于画图的小程序<1450kb>
28,detect.zip
用差影法检测图象(25KB)
29,maslog.zip
综合录井图(418KB)
30,mfdraw.zip
多功能绘图(175KB)
31,mftab.zip
自由表格(63KB)
32,cimage.zip
一套图像处理程序,支持JPEG、GIF和PNG三种格式(892KB)
33,thinkr30.zip
简单的电子表格程序(141KB)
34,aseasy5.zip
另一个电子表格程序(319KB)
35,free.zip
一个电子表格程序,它能从脚本中处理数据(17KB)
36,iedit32.zip
在DOS中创建或编辑WINDOWS的图标(69KB)
37,giflt150.zip
保持GIF的可视面但减小它的大小25%(50KB)
38,gds31f.zip
观看,替换和转换 GIF/JPG/PCX/TIF/IFF/LBM/DL/ HAM/BMP/RLE/TGA/MAC/WPG/CUT/ANSI/TXT/IMG/ PBM/CUT/GL/FLI/MPG, 显示极小的图象(370KB)
39,fview10.zip
观看JPEG/GIF/TARGA 文件(72KB)
40,dta22b2.zip
从TGA文件创建FLI/FLC动画(254KB)
41,dfe-104.zip
显示字体编辑器能为EGA和VGA显示器创建新字体(219KB)
42,cmorph21.zip
create morphed images with TGA/IMG/BMP/GIF/IPI/PCX files(630KB)
43,bmp2ico.zip
转换BMP文件到WINDOWS 3.X的ICO文件(22KB)
44,alch151.zip
图形转换器(359KB)
45,aaplay10.zip
Autodesk Animator's FLI player(53KB)
46,a2r103.zip
转换ANSI 屏幕到RIP格式(17KB)
47,show204.zip
GIF/PCX/JPEG 观察器(252KB)
48,bmp.zip
操纵位图的开发包(78KB)
49,draw_in.zip
在状态条里显现图(29KB)
50,cimageb.zip
读写jpg,dib文件的类。(267KB)
51,RGNC.zip
想制做超cool图形界面吗用它吧。(18KB)
52,CISBitmap.zip
这个从Cbitmap派生的位图类使你可以通过指定一种颜色把一幅位图变透明,而它的使用差不多同Cbitamp一样简单。(2KB)
53,Cdib.zip
这个类库可以实现设备无关位图的创建,显示,读入,保存,捕捉位图(6KB)
54,geotrans.zip
行程编码,JPEG压缩编码(基本系统)(32KB)
55,smooth.zip
图象的检测,模板匹配算法代码(24KB)
56,dither.zip
图象的边沿检测与提取,轮廓跟踪算法代码(24KB)
57,colorrope.zip
腐蚀,膨胀,细化算法代码(31KB)
58,morph.zip
直方图修正和彩色变换算法代码(17KB)
59,edge.zip
实现图案化和抖动技术以及bmp2txt源代码(34KB)
60,compress.zip
图象的几何变换算法(128KB)
61,tga2gif.zip
TGA文件转换为GIF文件。(14KB)
62,tooltip.zip
可以多行显示的提示条(32KB)
63,yearmonth.zip
选择年/月的控制(39KB)
64,calen32a.zip
提供日历功能的动态库, 含有演示代码(79KB)
65,mappin.zip
你可以在你的GIS(地图信息系统)中使用这些源程序,因为它演示了在地图上的图钉效果,运行这个程序你可以在View中移动一些图标(286KB)
66,storage.zip
文件存储和流化的一些类(10KB)
67,Redraw.zip
克服控制闪烁问题(1KB)
1,01.zipDisplaying a 256 color bitmap在程序中显示256色的位图(6KB)2,02.zipCreating a bitmap object from a BMP file从位图文件中创建位图对象(6KB)3,03.zipAn auto-sizing bitmap picture control一个自适应大小的位图控件(16KB)4,04.zipWriting a bitmap to a BMP file将一个位图写到BMP文件中(11KB)5,05.zipBitmap background in MDI Client在多文档客户程序中增加位图底图(4KB)6,06.zipConverting a bitmap to a region将一个位图转换成一个区域(7KB)7,07.zipConverting a bitmap to a region - memory leak fix 将一个位图转换成一个区域--内存泄露的修正(4KB)8,08.zipTransparent Bitmap实现透明的位图(7KB)9,09.zipCopying a bitmap to clipboard拷贝一个位图到剪贴板(5KB)10,10.zipConverting DDB to DIB将一个设备相关的位图转换成设备无关的位图(6KB)11,11.zipConverting DIB to DDB将一个设备无关的位图转换成设备相关的位图(5KB)12,12.zipCreating a DIB section from a BMP file 从BMP文件中创建一个设备无关的位图(5KB)13,13.zipGetting the dimensions of a bitmap得到一个位图的尺寸(4KB)14,14.zipDraw bitmap with grayed 3D effect画一副3维灰边的位图(6KB)15,15.zipDrawing a bitmap显示位图(7KB)16,16.zipDrawing a bitmap from a BMP file从BMP文件中装入位图并显示(6KB)17,17.zipEBGFX Library 推荐一个强大的EBGFX图形库(15KB)18,18.zipEmboss text and other shape on your bitmap 将文字以浮雕方式嵌入你的位图(7KB)19,19.zipApply a 3D bitmap pattern on text or other shapes将文字上色(3维的位图模板)(6KB)20,20.zipEncapsulated Dib API压缩设备无关位图的API(5KB)21,21.zipAn enhanced DIBLOOK sample 一个增强的DIBLOOK例子(5KB)22,22.zipFade in / Fade out Images using Palette animation使用生动的调色板淡入/淡出位图(8KB)23,23.zipPainting the background for a CFormView derived class在CFromView中画背景图(7KB)24,24.zipGradient Fill 有坡度的填充(5KB)25,25.zipPaint a Gradient Color Background显示渐变的背景(6KB)26,26.zipDrawing an image in grayscale画位图到一个灰色刻度中(5KB)27,27.zipFading from color to grayscale a

16,551

社区成员

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

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

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