1. download the latest cximage 702 source code from http://sourceforge.net/projects/cximage;
2. After decompression, open the cximagefull_vc10.sln project as an administrator. Before compilation, change the character set of each project attribute from the original use Unicode Character Set to use multi-bytecharacter set, first, compile the nine libraries Jasper, JBIG, JPEG, libdcr, libpsd, MNG, PNG, Tiff, and zlib, then compile cximage and cximagecrtdll, compile cximagemfcdll, and compile cximagemfcdll before compiling cximagemfcdll, first, modify its attributes, linker-> input-> additional dependencies, and set $ (outdir) PNG. change lib .. /.. /debug/PNG. lib (.. /.. /release/PNG. lib), and finally compile the demo and demodll. After all are compiled, the corresponding static and dynamic libraries can be generated;
3. Currently, cximage supports the following image formats: BMP, GIF, JPG, PNG, ICO, Tif, TGA, PCX, wbmp, WMF, JP2, JPC, pgx, PNM, Ras, jbg, MNG, ska, raw, and PSD;
4. You can open index.htm to view the image operations in cximage;
5. Create a new console project testcximage, set character set to use multi-byte character set, and the content of each file is:
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;}
Compilation and simple use of cximage