【文件属性】:
文件名称:JpegLib, 图片库
文件大小:330KB
文件格式:RAR
更新时间:2013-12-21 13:41:19
JpegLib, 图片库
JpegLib是一款免费开源的图片库,我用它将bmp转换成jpg。下面是代码:
#include "BMPFILE.H"
#include "Jpegfile.h"
BOOL BMP2JPG(const char *bmp_file, const char *jpg_file)
{
try
{
BMPFile bmpFile;
BYTE *m_buf;
UINT m_width, m_height;
m_buf = bmpFile.LoadBMP(bmp_file, &m_width, &m_height);
if ((m_buf==NULL) || (bmpFile.m_errorText!="OK")) {
m_buf=NULL;
return false;
}
JpegFile::BGRFromRGB(m_buf, m_width, m_height);
// vertical flip for display
JpegFile::VertFlipBuf(m_buf, m_width * 3, m_height);
// we vertical flip for display. undo that.
JpegFile::VertFlipBuf(m_buf, m_width * 3, m_height);
// we swap red and blue for display, undo that.
JpegFile::BGRFromRGB(m_buf, m_width, m_height);
BOOL ok = JpegFile::RGBToJpegFile(jpg_file, m_buf, m_width, m_height, true, 75); // quality value 1-100.
delete [] m_buf;
return ok;
}
catch(...)
{
}
}
网友评论
- 不错的,这里的资源都不错。
- 很有研究价值啊,收藏。
- 程序可用,资源不错。有很大帮助。
- 写的不错,很实用!
- 还要看看在DOS下如何使用
- 可以研究源代码,资源不错
- 可以研究源代码,资源不错
- 资源不错,我没有研究透,继续看!
- 很好的资源,但是这个如何使用啊,我在里面想找一个RGBtoJPEGFILE的函数,但是找不到啊,希望高人能指点一下
- 可以研究源代码,对于提高自身的能力有很大帮助。
- 研究源代码对自己很有帮助