如何使用GDI+在内存中缩放bmp并保存

fenex 2004-08-04 11:49:20
如1024×768的转成800×600的。
...全文
174 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Gozhhu 2004-08-15
  • 打赏
  • 举报
回复
主要是用GetThumbnailImage
Gozhhu 2004-08-15
  • 打赏
  • 举报
回复
BSTR bstrfromfile = fromfile.AllocSysString();
Image oriimage(bstrfromfile);
::SysFreeString(bstrfromfile);

Image * image = oriimage.GetThumbnailImage(800, 600, NULL, NULL);

CLSID clsid;
GetEncoderClsid(L"image/jpeg", &clsid);
tofile.Replace('.','_');
tofile += ".jpg";

BSTR bstrtofile = tofile.AllocSysString();
Status stat = image->Save(bstrtofile, &clsid, NULL);
::SysFreeString(bstrtofile);

delete image;

if(stat == Ok)
return TRUE;
else
return FALSE;
fenex 2004-08-15
  • 打赏
  • 举报
回复
upupup
DentistryDoctor 2004-08-04
  • 打赏
  • 举报
回复
http://www.codeguru.com/Cpp/G-M/bitmap/specialeffects/article.php/c4897/

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧