CxImage的编译及简单使用举例

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:

 

#pragma once

#include "targetver.h"

#include <stdio.h>

#include "../../cximage702_full/CxImage/ximage.h"


stdafx.cpp:

 

 

#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:

 

 

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


GitHubhttps://github.com/fengbingchun/CxImage_Test

 

 

 

  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
### 回答1: CXImage是一个易于使用的C++图像处理库,可以处理多种格式的图像并提供了许多图像编辑功能。如果想在Linux平台上使用CXImage,首先需要从官方网站或GitHub代码仓库下载代码。然后按照以下步骤进行: 1. 将代码解压缩到您想要存放的目录中。 2. 打开终端并进入该目录。 3. 使用make命令生成库文件。 4. 在生成的lib目录中找到生成的库文件。 5. 使用make install命令将库文件安装到系统目录中。 至此,您就可以开始在Linux平台上使用CXImage库进行图像处理了。您可以在代码中引用生成的库文件,并使用CXImage库提供的各种函数来处理不同格式的图像和编辑图像。此外,CXImage库还提供了许多示例代码,您可以使用它们来进一步了解如何使用该库。 ### 回答2: 在Linux系统下下载CXImage,可以按照以下步骤进行: 1. 打开终端,使用命令行工具。 2. 确保您的系统已经安装了Git和CMake。如果没有安装,可以使用以下命令进行安装: ``` sudo apt-get install git cmake ``` 3. 使用Git命令克隆CXImage的源代码仓库。在终端中运行以下命令: ``` git clone https://github.com/ibnudana/cximage.git ``` 4. 进入克隆下来的CXImage目录: ``` cd cximage ``` 5. 创建一个新的目录,用于构建CXImage的对象文件: ``` mkdir build cd build ``` 6. 运行CMake生成Makefile: ``` cmake .. ``` 7. 运行make命令进行编译: ``` make ``` 8. 完成编译后,在build目录中会生成cximage库文件,可以使用它来进行图像处理等操作。 以上是在Linux系统下下载CXImage的基本步骤。根据实际情况,您可能需要解决一些依赖项或配置问题。请确保您的系统满足CXImage的要求,并参考CXImage的文档进行进一步的配置和安装。 ### 回答3: 在 Linux 系统下下载 cximage 需要执行以下步骤: 1. 打开终端(Terminal),使用以下命令安装 git:sudo apt-get install git 2. 使用以下命令克隆 cximage 仓库:git clone https://github.com/Delgan/cximage.git 3. 进入 cximage 目录:cd cximage 4. 使用以下命令编译 cximage:make 5. 编译完成后,在 cximage 目录中将生成可执行文件 cximage

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值