如何在一个jpg图片上面叠加文字
1.将jpg转为bmp格式 2.在bmp文件上写上所需文字 3.将写入文字的bmp文件重新转为jpg格式
http://dev.csdn.net/develop/article/22/22948.shtm
2步的部分代码
CBitmap* pBmp =new CBitmap();
if(NULL != pBmp)
{
pBmp->CreateBitmap(nwidth, nheight, 1, ncolordepth, NULL);
if(NULL != pBmp->GetSafeHandle())
{
CDC BmpDC;
BmpDC.CreateCompatibleDC(NULL);
CBitmap* pOldBmp =BmpDC.SelectObject(pBmp);
RECT rect;
memset(&rect, 0, sizeof(RECT));
rect.left =nwidth;
rect.bottom =nheight;
CBrush m_Brush;
m_Brush.CreateSolidBrush(RGB(255, 0, 0));
BmpDC.FillRect(&rect, &m_Brush);
m_Brush.DeleteObject();
BmpDC.DrawText("asdf",//剩余参数自已填.....);
BmpDC.SelectObject(pOldBmp);
BmpDC.SelectPalette(pOldPal, TRUE);
BmpDC.DeleteDC();
}
}
return pBmp;
//这个pBmp指针就是一幅有文字的图像了。
//使用完BmP后请Delete
http://search.csdn.net/Expert/topic/1238/1238134.xml?temp=.867428
(iwgh)