D
dd
Unregistered / Unconfirmed
GUEST, unregistred user!
程序段如下:
var
i: integer;
asbmp: array[1..20] of tbitmap;
tmpjpg: tjpegimage;
begin
tmpjpg:=tjpegimage.Create;
tmpjpg.Smoothing:=true;
for i:=1 to 20 do
begin
tmpjpg.LoadFromFile('data/'+inttostr(i)+'.jpg');
tmpjpg.SaveToFile('temp/'+inttostr(i)+'.jpg'); //检测用
asbmp:=tbitmap.Create;
asbmp.width:=192;
asbmp.height:=142;
asbmp.pixelformat:=pf24bit;
asbmp.canvas.StretchDraw(rect(0,0,192,142),tmpjpg);
asbmp.savetofile('temp/'+inttostr(i)+'.bmp'); //检测用
end;
tmpjpg.free;
end;
其中data/有1.jpg....20.jpg
运行后temp/下1.jpg....20.jpg与data/一一对应.
但temp/1.bmp....20.bmp中全都是1.jpg中的图像,似乎tmpjpg第一次load后
并没更新一样!
另:将tmpjpg:=tjpegimage.create; 和 tmpjpg.free 加入for循环中又正常了
WHY ?????
THANKS!
var
i: integer;
asbmp: array[1..20] of tbitmap;
tmpjpg: tjpegimage;
begin
tmpjpg:=tjpegimage.Create;
tmpjpg.Smoothing:=true;
for i:=1 to 20 do
begin
tmpjpg.LoadFromFile('data/'+inttostr(i)+'.jpg');
tmpjpg.SaveToFile('temp/'+inttostr(i)+'.jpg'); //检测用
asbmp:=tbitmap.Create;
asbmp.width:=192;
asbmp.height:=142;
asbmp.pixelformat:=pf24bit;
asbmp.canvas.StretchDraw(rect(0,0,192,142),tmpjpg);
asbmp.savetofile('temp/'+inttostr(i)+'.bmp'); //检测用
end;
tmpjpg.free;
end;
其中data/有1.jpg....20.jpg
运行后temp/下1.jpg....20.jpg与data/一一对应.
但temp/1.bmp....20.bmp中全都是1.jpg中的图像,似乎tmpjpg第一次load后
并没更新一样!
另:将tmpjpg:=tjpegimage.create; 和 tmpjpg.free 加入for循环中又正常了
WHY ?????
THANKS!