CxMemFile memfile((BYTE*)ImageSrcData, ImageSrcSize); // 显式使用CxMemFile对象
/*memfile.Write(ImageSrcData,1, ImageSrcSize);
memfile.Close();*/
CxImage image(&memfile, CXIMAGE_FORMAT_JPG);
image.Save("image_src.jpg", CXIMAGE_FORMAT_JPG);
//CxImage *ximage=new CxImage((uint8_t*)ImageSrcData, ImageSrcSize, CXIMAGE_FORMAT_JPG);
//应用CXImage将图像变成我们指定的大小
CxImage smallImg;
bool bRes = image.Resample(60, 50, 0, &smallImg);
/*image.Resample(新宽度, 新高度, 0, &smallImg);*/
smallImg.Save("small.jpg", CXIMAGE_SUPPORT_JPG);
unsigned char *pJpgDestBuff = NULL;
int32_t pJpgDestSize = 0;
bool bRet = smallImg.Encode(pJpgDestBuff, pJpgDestSize, CXIMAGE_FORMAT_JPG);
if (bRet)
{
ImgDstData = new unsigned char[pJpgDestSize];
memcpy(ImgDstData, pJpgDestBuff,pJpgDestSize);
*ImgDstSize = pJpgDestSize;
// smallImg.Save("imageDecode.jpg", CXIMAGE_FORMAT_JPG);
free(pJpgDestBuff);
}
/*memfile.Write(ImageSrcData,1, ImageSrcSize);
memfile.Close();*/
CxImage image(&memfile, CXIMAGE_FORMAT_JPG);
image.Save("image_src.jpg", CXIMAGE_FORMAT_JPG);
//CxImage *ximage=new CxImage((uint8_t*)ImageSrcData, ImageSrcSize, CXIMAGE_FORMAT_JPG);
//应用CXImage将图像变成我们指定的大小
CxImage smallImg;
bool bRes = image.Resample(60, 50, 0, &smallImg);
/*image.Resample(新宽度, 新高度, 0, &smallImg);*/
smallImg.Save("small.jpg", CXIMAGE_SUPPORT_JPG);
unsigned char *pJpgDestBuff = NULL;
int32_t pJpgDestSize = 0;
bool bRet = smallImg.Encode(pJpgDestBuff, pJpgDestSize, CXIMAGE_FORMAT_JPG);
if (bRet)
{
ImgDstData = new unsigned char[pJpgDestSize];
memcpy(ImgDstData, pJpgDestBuff,pJpgDestSize);
*ImgDstSize = pJpgDestSize;
// smallImg.Save("imageDecode.jpg", CXIMAGE_FORMAT_JPG);
free(pJpgDestBuff);
}