如何将bmp文件转换成wmf或者emf格式?

dbwolf 2003-01-14 11:17:02
如题
...全文
632 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hdaq 2003-01-14
  • 打赏
  • 举报
回复
Graphics::TMetafile *newwmf = Graphics::new TMetafile();
newwmf->Width = Image1->Picture->Bitmap->Width;
newwmf->Height = Image1->Picture->Bitmap->Height;

Graphics::TMetafileCanvas *newmcvs = new Graphics::TMetafileCanvas(newwmf,0);
newmcvs->StretchDraw(Rect(0,0,Image1->Picture->Bitmap->Width,Image1->Picture->Bitmap->Height),
Image1->Picture->Bitmap);
delete newmcvs;
newwmf->Enhanced = false;
newwmf->SaveToFile("d:\\abcd5.WMF");
delete newwmf;
hdaq 2003-01-14
  • 打赏
  • 举报
回复
Graphics::TMetafile *newwmf = Graphics::new TMetafile();
newwmf->Width = Image1->Picture->Bitmap->Width;
newwmf->Height = Image1->Picture->Bitmap->Height;

Graphics::TMetafileCanvas *newmcvs = new Graphics::TMetafileCanvas(newwmf,0);
newmcvs->StretchDraw(Rect(0,0,Image1->Picture->Bitmap->Width,Image1->Picture->Bitmap->Height),
Image1->Picture->Bitmap);
delete newmcvs;
newwmf->Enhanced = true;
newwmf->SaveToFile("d:\\abcd5.EMF");
delete newwmf;
cscer 2003-01-14
  • 打赏
  • 举报
回复
Graphics::TMetaFile *mfTemp;
try
{
mfTemp= new Graphics::TMetaFile();
mfTemp->Assign(Image1->Picture);

mfTemp->SaveToFile("C:\\Temp.emf");
}
__finally
{
delete mfTemp;
mfTemp= NULL;
}
yuyulily 2003-01-14
  • 打赏
  • 举报
回复
给你段DELPHI的:
aimingoo (1998-9-10 8:42:59)
下面的内容回答houyg的提问:
{File Convert[BMP&WMF/EMF] Tool Ver1.0, Full source by aiming.
===============================================================
请用命令行dcc -cc bmp2wmf.dpr编译,或设置"生成控制台程序"编译项
在IDE中编译。生成的程序只能在win95的DOS窗口中使用。
===============================================================}
program bmp2wmf;
uses
Graphics, SysUtils;

const SoftWareName = 'File Convert[BMP&WMF/EMF] Tool Ver1.0,';
CompanyName = 'copyright(c) 1994,98 Keenvim software';
Width = 80 - Length(SoftWareName);
var aBmp : Tbitmap;
aWmf : TMetaFile;
param1 : String;
paramExt : String;

begin
Write(SoftWareName,CompanyName:Width);
Writeln('By Mr. Aiming Zhou.'); Writeln;
if ParamCount >= 1 then
begin
param1 := UpperCase(ParamStr(1));
paramExt := ExtractFileExt(param1);
end;
if (ParamCount < 1) or
(ParamCount > 2) or
((ParamCount = 2) and (UpperCase(ParamStr(2)) <> '/E')) or
((paramExt <> '.BMP') and (paramExt <> '.WMF')
and (paramExt <> '.EMF')) then
begin
writeln('ERROR: Param Invalid!');
writeln('Usage: Bmp2Wmf <.Bmp/.Wmf> [/E]');
writeln('notes: Param [/E] Define ouput .EMF File format.');
exit;
end;

aBmp := Tbitmap.Create;
aWmf := TMetaFile.Create;
if paramExt = '.BMP'
then
begin
aBmp.LoadFromFile(param1);
aWmf.Width := aBmp.Width;
aWmf.Height := aBmp.Height;
if ParamCount = 2 then aWmf.Enhanced := true
else aWmf.Enhanced := false;

with TMetaFileCanvas.CreateWithComment(
aWmf,0,'Aiming''s Conver program','V1.0') do
Try Draw(0,0,aBmp);
Finally Free;
end;
if aWmf.Enhanced
then aWmf.SaveToFile(copy(param1,1,pos('.',param1)) + 'EMF')
else aWmf.SaveToFile(copy(param1,1,pos('.',param1)) + 'WMF');
if aWmf.Enhanced
then writeln(param1, '==>',
copy(param1,1,pos('.',param1)) + 'EMF', #$0D)
else writeln(param1, '==>',
copy(param1,1,pos('.',param1)) + 'WMF', #$0D);
end
else
begin
aWmf.LoadFromFile(param1);
aBmp.Width := aWmf.Width;
aBmp.Height := aWmf.Height;
aBmp.Canvas.Draw(0,0,aWmf);
aBmp.SaveToFile(copy(param1,1,pos('.',param1)) + 'BMP');
writeln(param1, '==>',
copy(param1,1,pos('.',param1)) + 'EMF', #$0D);
end;
aBmp.Destroy;
aWmf.Destroy;
end.

====================================================================
哈哈哈,怎么大家都在提这个问题??是不是也是用Cool 3D的缘故?
前些天为了用Cool 3D v2. 找了不下xx个软件,都没有办法转换bmp to wmf.
最后一怒之下,自己写了个转换工具。当天便在www.expert-exchanges.com
站上看到这个问题贴出,我便贴出了源码,今天又见到了,老规矩,源码一份。


13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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