Compilation and simple use of cximage

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.