关于图像处理的一个问题?(分不够可再加)急!(200分)

惟一

Unregistered / Unconfirmed
GUEST, unregistred user!
如何实现图像的按比例放大、缩小。如一张800*600的图像,我要缩放到500*300(任意),

我怎么在程序中实现,有代码更好!急!!
 
很多网站上都有关于图像处理的源码。
 
我得email:huazai@zju.edu.cn我有你要的东西!
 
图象缩小:(其中backbmp为源图)
procedure TMainForm.ZoomoutClick(Sender: TObject);
var
bmp: TBITMAP;
begin

begin
try
bmp := Tbitmap.Create;
bmp.Width := trunc(0.9 * childForm.image1.width);
bmp.Height := trunc(0.9 * childForm.image1.Height);
SetStretchBltMode(Bmp.Canvas.Handle, HalfTone); //如此设置不易失真
stretchblt(bmp.Canvas.Handle, 0, 0, bmp.Width, bmp.Height,
backbmp.Canvas.Handle, 0, 0,
backbmp.Width, backbmp.height, srccopy);
childForm.Image1.Top := childForm.Height div 2 - bmp.Height div 2;
childForm.Image1.Left := childForm.Width div 2 - bmp.Width div 2;
childForm.image1.Picture.Bitmap.Assign(bmp);
bmp.Free;
except
ShowMessage('出错!');
end;

end;

end;
 
感谢huazai,你的这种可以处理BMP格式的图像。如果我想处理GIF还有JPg的呢?

 
接受答案了.
 
顶部