CxImage的编译及简单使用举例
2016-03-24 16:17
507 查看
我自己修改后用VS2010编译好的版本:
http://download.csdn.net/detail/qing666888/9471800
1、 从http://sourceforge.net/projects/cximage/下载最新的CxImage 702源码;
2、 解压缩后,以管理员身份打开CxImageFull_vc10.sln工程,在编译之前先将每个工程属性的Character Set由原先的Use Unicode Character Set改为Use Multi-ByteCharacter Set,首先编译jasper、jbig、jpeg、libdcr、libpsd、mng、png、tiff、zlib这9个库,然后编译cximage,cximagecrtdll,在接着编译cximagemfcdll,在编译cximagemfcdll之前,先修改其属性,linker->input->Additional
Dependencies,将$(OutDir)png.lib等改为../../Debug/png.lib(../../Release/png.lib),最后编译demo、demodll;全部编译完后即可生成相应的静态库和动态库;
3、 目前CxImage支持的图像格式包括:bmp、gif、jpg、png、ico、tif、tga、pcx、wbmp、wmf、jp2、jpc、pgx、pnm、ras、jbg、mng、ska、raw和psd;
4、 CxImage中所包含的图像操作可通过打开index.htm来查看;
5、新建一个控制台工程testCxImage,将Character Set设为Use Multi-Byte Character Set,各个文件的内容为:
stdafx.h:
[cpp] view
plain copy
#pragma once
#include "targetver.h"
#include <stdio.h>
#include "../../cximage702_full/CxImage/ximage.h"
stdafx.cpp:
[cpp] view
plain copy
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
#ifdef _DEBUG
#pragma comment(lib, "../../cximage702_full/Debug/cximage.lib")
#pragma comment(lib, "../../cximage702_full/Debug/jasper.lib")
#pragma comment(lib, "../../cximage702_full/Debug/jbig.lib")
#pragma comment(lib, "../../cximage702_full/Debug/jpeg.lib")
#pragma comment(lib, "../../cximage702_full/Debug/libdcr.lib")
#pragma comment(lib, "../../cximage702_full/Debug/libpsd.lib")
#pragma comment(lib, "../../cximage702_full/Debug/mng.lib")
#pragma comment(lib, "../../cximage702_full/Debug/png.lib")
#pragma comment(lib, "../../cximage702_full/Debug/tiff.lib")
#pragma comment(lib, "../../cximage702_full/Debug/zlib.lib")
#else
#pragma comment(lib, "../../cximage702_full/Release/cximage.lib")
#pragma comment(lib, "../../cximage702_full/Release/jasper.lib")
#pragma comment(lib, "../../cximage702_full/Release/jbig.lib")
#pragma comment(lib, "../../cximage702_full/Release/jpeg.lib")
#pragma comment(lib, "../../cximage702_full/Release/libdcr.lib")
#pragma comment(lib, "../../cximage702_full/Release/libpsd.lib")
#pragma comment(lib, "../../cximage702_full/Release/mng.lib")
#pragma comment(lib, "../../cximage702_full/Release/png.lib")
#pragma comment(lib, "../../cximage702_full/Release/tiff.lib")
#pragma comment(lib, "../../cximage702_full/Release/zlib.lib")
#endif
testCxImage.cpp:
[cpp] view
plain copy
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
CxImage image;
string imageName = "1.jpg";
string imageSave = "2.tif";
image.Load(imageName.c_str(), CXIMAGE_FORMAT_JPG);
cout<<image.GetBpp()<<endl;
if (image.IsValid()) {
image.GrayScale();
image.Save(imageSave.c_str(), CXIMAGE_FORMAT_TIF);
cout<<"success"<<endl;
}
cout<<"ok"<<endl;
return 0;
}
GitHub:https://github.com/fengbingchun/CxImage_Test
http://download.csdn.net/detail/qing666888/9471800
1、 从http://sourceforge.net/projects/cximage/下载最新的CxImage 702源码;
2、 解压缩后,以管理员身份打开CxImageFull_vc10.sln工程,在编译之前先将每个工程属性的Character Set由原先的Use Unicode Character Set改为Use Multi-ByteCharacter Set,首先编译jasper、jbig、jpeg、libdcr、libpsd、mng、png、tiff、zlib这9个库,然后编译cximage,cximagecrtdll,在接着编译cximagemfcdll,在编译cximagemfcdll之前,先修改其属性,linker->input->Additional
Dependencies,将$(OutDir)png.lib等改为../../Debug/png.lib(../../Release/png.lib),最后编译demo、demodll;全部编译完后即可生成相应的静态库和动态库;
3、 目前CxImage支持的图像格式包括:bmp、gif、jpg、png、ico、tif、tga、pcx、wbmp、wmf、jp2、jpc、pgx、pnm、ras、jbg、mng、ska、raw和psd;
4、 CxImage中所包含的图像操作可通过打开index.htm来查看;
5、新建一个控制台工程testCxImage,将Character Set设为Use Multi-Byte Character Set,各个文件的内容为:
stdafx.h:
[cpp] view
plain copy
#pragma once
#include "targetver.h"
#include <stdio.h>
#include "../../cximage702_full/CxImage/ximage.h"
stdafx.cpp:
[cpp] view
plain copy
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
#ifdef _DEBUG
#pragma comment(lib, "../../cximage702_full/Debug/cximage.lib")
#pragma comment(lib, "../../cximage702_full/Debug/jasper.lib")
#pragma comment(lib, "../../cximage702_full/Debug/jbig.lib")
#pragma comment(lib, "../../cximage702_full/Debug/jpeg.lib")
#pragma comment(lib, "../../cximage702_full/Debug/libdcr.lib")
#pragma comment(lib, "../../cximage702_full/Debug/libpsd.lib")
#pragma comment(lib, "../../cximage702_full/Debug/mng.lib")
#pragma comment(lib, "../../cximage702_full/Debug/png.lib")
#pragma comment(lib, "../../cximage702_full/Debug/tiff.lib")
#pragma comment(lib, "../../cximage702_full/Debug/zlib.lib")
#else
#pragma comment(lib, "../../cximage702_full/Release/cximage.lib")
#pragma comment(lib, "../../cximage702_full/Release/jasper.lib")
#pragma comment(lib, "../../cximage702_full/Release/jbig.lib")
#pragma comment(lib, "../../cximage702_full/Release/jpeg.lib")
#pragma comment(lib, "../../cximage702_full/Release/libdcr.lib")
#pragma comment(lib, "../../cximage702_full/Release/libpsd.lib")
#pragma comment(lib, "../../cximage702_full/Release/mng.lib")
#pragma comment(lib, "../../cximage702_full/Release/png.lib")
#pragma comment(lib, "../../cximage702_full/Release/tiff.lib")
#pragma comment(lib, "../../cximage702_full/Release/zlib.lib")
#endif
testCxImage.cpp:
[cpp] view
plain copy
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
CxImage image;
string imageName = "1.jpg";
string imageSave = "2.tif";
image.Load(imageName.c_str(), CXIMAGE_FORMAT_JPG);
cout<<image.GetBpp()<<endl;
if (image.IsValid()) {
image.GrayScale();
image.Save(imageSave.c_str(), CXIMAGE_FORMAT_TIF);
cout<<"success"<<endl;
}
cout<<"ok"<<endl;
return 0;
}
GitHub:https://github.com/fengbingchun/CxImage_Test
相关文章推荐
- 高效的找出两个List中的不同元素
- IOS 开发 证书显示 此证书签发者无效
- 三大运营商去年一共赚了1391亿元 中移动无线上网收入达到2009亿元
- SqlServer2008安装时提示重启计算机失败 解决办法
- php时间日期处理
- Java编程之数组转换列表的陷阱
- 线性函数
- 垃圾收集算法
- F - Count the Colors
- ubuntu下使用OBS开斗鱼直播
- cssHack
- 学习、阅读笔记——jsonP&Ajax
- java中的强、软、弱和虚引用
- String与InputStream的互相转换
- SecureCRT远程登录ubuntu
- Python datetime的简单使用
- 204. Count Primes
- 高性能网关设备及服务实践
- PHP操作SQLITE
- SVN的使用