两张图片拼接成一张图片,请问怎么做?
把两张图片从外部载入到软件中,然后把两张图片拼接成一张图片保存到本地。请问下,这该用vc.net 怎么做啊?
[解决办法]
CxImage 看一下
void MergedImage(CString filename1,CString filename2,CString m_strEndFileName)//合并图片
{
int w1,h1,w2,h2,bpp;//w1,h1为原始尺寸大小 w2,h2为合并图后的大小
w1 = img1.GetWidth();
h1 = img1.GetHeight();
w2 = w1 ;
h2 = h1 + h1/2;
//分别缩略第一张、第二张图
CxImage img1SL,img2SL;
float scale = 0.5;
img1SL = img1;//
img1SL.Resample(img1.GetWidth()*scale,img1.GetHeight()*scale);
img1SL.Save(filename1,CXIMAGE_FORMAT_JPG);
img2SL = img2;
img2SL.Resample(img2.GetWidth()*scale,img2.GetHeight()*scale);
img2SL.Save(filename2,CXIMAGE_FORMAT_JPG);
//
bpp = img1.GetBpp();
img3.Create(w2,h2,bpp);
img3.MixFrom(img1,0,h1/2);
img3.MixFrom(img1SL,0,0);
img3.MixFrom(img2SL,w1/2,0);
CString m_strSavePic;
m_strSavePic.Format("%s%s",filename2,".jpg");
img3.Save(m_strEndFileName,CXIMAGE_FORMAT_JPG);//最终的图片目录
::DeleteFile(filename1);
::DeleteFile(filename2);
}