那位有bmp与jpg转换的源码赞助?

ustc_tweeg 2002-06-13 11:14:46
如题
...全文
40 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
ustc_tweeg 2002-06-13
  • 打赏
  • 举报
回复
http://www.vckbase.com/code---------------GREAT!
pcman1990 2002-06-13
  • 打赏
  • 举报
回复
http://www.vckbase.com/code
jpeglib.zip可以显示JPEG文件,进行JPEG和BMP之间的相互转换,并可以保存为灰度JPG图像


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)

ustc_tweeg 2002-06-13
  • 打赏
  • 举报
回复
to masterz : how to get it?
to mfkzj:ustc_tweeg@163.net wo yao!
mfkzj 2002-06-13
  • 打赏
  • 举报
回复
我这里有一个类 要不要?
mfkzj@263.net
masterz 2002-06-13
  • 打赏
  • 举报
回复
need GDI+ header files to compile, need GDI+ dll to run
mfkzj 2002-06-13
  • 打赏
  • 举报
回复
我这里有一个类 要不要?
mfkzj@263.net
ustc_tweeg 2002-06-13
  • 打赏
  • 举报
回复
编译通不过呀大虾
wistaria 2002-06-13
  • 打赏
  • 举报
回复
JPEG<->GIF/BMP/TGA/RLE/PPM/PGM
ftp://x2ftp.oulu.fi/pub/msdos/programming/convert/jpg5a.zip
ftp://x2ftp.oulu.fi/pub/msdos/programming/convert/jpg5a386.zip
masterz 2002-06-13
  • 打赏
  • 举报
回复
#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-06-13
  • 打赏
  • 举报
回复
#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

16,472

社区成员

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

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

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