首页 > 其他分享 >CImage得到位图的大小

CImage得到位图的大小

时间:2022-12-23 18:01:31浏览次数:38  
标签:CFile hMem BMPfile image 大小 位图 CImage pstm

CImage image;
image.Load(_T("1.jpg"));
//HBITMAP hBitmap=image.Detach();

HGLOBAL m_hMem = GlobalAlloc(GMEM_MOVEABLE, 0);
IStream *pstm=NULL;
CreateStreamOnHGlobal(m_hMem, TRUE, &pstm);

image.Save(pstm,ImageFormatBMP);


LARGE_INTEGER liBeggining = { 0 };
pstm->Seek(liBeggining, STREAM_SEEK_SET, NULL);
DWORD size = GlobalSize(m_hMem);
LPBYTE lpData = (LPBYTE)GlobalLock(m_hMem);
CFile BMPfile(L"11.bmp",CFile::modeReadWrite | CFile::modeCreate);
BMPfile.Write (lpData,size);
BMPfile.Close();
pstm->Release();
GlobalUnlock(m_hMem);

标签:CFile,hMem,BMPfile,image,大小,位图,CImage,pstm
From: https://www.cnblogs.com/kn-zheng/p/17001260.html

相关文章