首页 > 代码库 > cxImageUser

cxImageUser

#pragma once

#include "include/ximage.h"

#ifdef _DEBUG
#pragma comment(lib, "lib/cximaged_x64.lib")
#pragma comment(lib, "lib/jasperd_x64.lib")
//#pragma comment(lib, "lib/jbigd_x64.lib")
#pragma comment(lib, "lib/Jpegd_x64.lib")
#pragma comment(lib, "lib/libdcrd_x64.lib")
#pragma comment(lib, "lib/mngd_x64.lib")
#pragma comment(lib, "lib/pngd_x64.lib")
#pragma comment(lib, "lib/Tiffd_x64.lib")
#pragma comment(lib, "lib/zlibd_x64.lib")
#else
#pragma comment(lib, "lib/cximage_x64.lib")
#pragma comment(lib, "lib/jasper_x64.lib")
//#pragma comment(lib, "lib/jbig_x64.lib")
#pragma comment(lib, "lib/Jpeg_x64.lib")
#pragma comment(lib, "lib/libdcr_x64.lib")
#pragma comment(lib, "lib/mng_x64.lib")
#pragma comment(lib, "lib/png_x64.lib")
#pragma comment(lib, "lib/Tiff_x64.lib")
#pragma comment(lib, "lib/zlib_x64.lib")
#endif // _DEBUG

class CxImageUser
{
public:
    CxImageUser();
    ~CxImageUser();

    int png2jpg(const CString& strSrcFile, const CString& strDstFile);

};
#include "stdafx.h"
#include "cxImageUserU.h"


CxImageUser::CxImageUser()
{

}

CxImageUser::~CxImageUser()
{

}

int CxImageUser::png2jpg( const CString& strSrcFile, const CString& strDstFile )
{
    CxImage  image; 
    //png -> jpg 
    image.Load(strSrcFile, CXIMAGE_FORMAT_PNG); 
    if (image.IsValid()){ 
        if(!image.IsGrayScale()) image.IncreaseBpp(24); 
        image.SetJpegQuality(80); 
        image.Save(strDstFile,CXIMAGE_FORMAT_JPG); 
    } 

    return 0;
}

 

cxImageUser