如何将一般的bmp文件转换成wmf或者emf格式?(空)(100分)

C

cpp

Unregistered / Unconfirmed
GUEST, unregistred user!
找个绘图软件如PHOTOSHOP读入BMP文件,再另存为你需要的格式。
 
H

houyg

Unregistered / Unconfirmed
GUEST, unregistred user!
但是PhotoShop不支持WMF或者EMF格式。最好是有比较小的应用程序或者Pascal源代码。
 
A

aimingoo

Unregistered / Unconfirmed
GUEST, unregistred user!
现在向版主“歪歪松”(YYSun ^-^)先生大发牢骚!!如下:
老大,你的BBS还有问题呢!!我从下午一直Post这个问题的
答案,到现在也没贴上。发了个"test!!!!",又能确认之!
为什么??
我将贴出的文本为3265byte,行数91,最大行长85。不过经
截短测试,不能贴信息与行长和行数无关!!!!
 
H

houyg

Unregistered / Unconfirmed
GUEST, unregistred user!
您知道答案吗?您可以直接E-mail给我(y.hou@263.net),我也会
告诉版主给你加分的,万分感激!
 
A

aimingoo

Unregistered / Unconfirmed
GUEST, unregistred user!
我给版主发了一个mail,他应该可以直接贴上去的。
不是想攒分,是因为将贴子Post给大家是这个论坛板的本意。所以就直接
Mail给版主了。
 
A

aimingoo

Unregistered / Unconfirmed
GUEST, unregistred user!
下面的内容回答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
站上看到这个问题贴出,我便贴出了源码,今天又见到了,老规矩,源码一份。
Houyg兄, 你就痛痛快快的掏钱付账罢。^-^
嘿嘿,黑黑,嘿嘿黑黑……
<hr>
请下载:<a href="/delphi/attachments/postit.zip">来自aimingoo的答案</a>
 
H

houyg

Unregistered / Unconfirmed
GUEST, unregistred user!
[我试了一下,效果挺好!答案接受了。三克油啦!!!]
 

Similar threads

回复
0
查看
851
不得闲
D
回复
0
查看
700
DelphiTeacher的专栏
D
D
回复
0
查看
724
DelphiTeacher的专栏
D
顶部