用程序读一个800*600的图像bmp格式
然后等比例缩小20% 保存为另一外一幅图bmp格式,怎样做
然后等比例缩小20% 保存为另一外一幅图bmp格式,怎样做
解决方案 »
- 在fastreport中分组时,怎么才能使每个group都有单独的序号?
- DBGridEh有问,请各位指导
- 关于Delphi整型取值范围
- 高手过来看一看,不弟有礼啦~~~ 如何将数据库中数据导出为excel文件,
- 如何控制dbgrid的某一列的输入问题
- 关于打包软件installshield express的一些用法??请高手指点啊
- 有没有简单的方法将‘yyyymmddhhmiss’的字符串转化为TdateTime形式
- 求解:怎么搞定模糊查询?
- 请教专家如何在DBGrid中显示多个数据表的内容?
- 为何说我的变量没有初始化?(Variable 'qryTemp' might not have been initialized)
- 如何限定程序的使用时间,比如一个程序使用10天后,必须输入序列号,才能再使用!
- 如何将Dbmemo植入Dbgrid中
procedure TfrmInsert.ZoomImage(var Bitmap:TBitmap; SetWidth:integer=320; SetHeight:integer=240);
var
DstRect: TRect;
begin
// Image1.Picture.Graphic.LoadFromFile('D:\1.bmp');
Bitmap.Width := SetWidth;
Bitmap.Height := SetHeight; Bitmap.Canvas.StretchDraw(Bitmap.Canvas.ClipRect,Image.Picture.Graphic);//其中Image为窗体上的控件! Image.Picture.Graphic := Bitmap;
Image.Invalidate; end;
procedure ZoomImage(var Bitmap: TBitmap; SetWidth: integer = 320; SetHeight:
integer = 240);
var
BitMapTmp: TBitmap;
begin
BitMapTmp := TBitmap.Create;
try
BitMapTmp.Assign(BitMap);
Bitmap.Width := SetWidth;
Bitmap.Height := SetHeight;
Bitmap.Canvas.StretchDraw(Bitmap.Canvas.ClipRect, BitMapTmp);
finally
BitMapTmp.Free;
end;
end;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;type
TForm1 = class(TForm)
Image1: TImage;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure ZoomImage(var Bitmap: TBitmap; SetWidth: integer = 320; SetHeight:
integer = 240);
var
BitMapTmp: TBitmap;
begin
BitMapTmp := TBitmap.Create;
try
BitMapTmp.Assign(BitMap);
Bitmap.Width := SetWidth;
Bitmap.Height := SetHeight;
Bitmap.Canvas.StretchDraw(Bitmap.Canvas.ClipRect, BitMapTmp);
finally
BitMapTmp.Free;
end;
end;procedure TForm1.BitBtn1Click(Sender: TObject);
var
BitMap:TBitMap;
W,H:Integer;
begin
BitMap:=TBitMap.Create;
BitMap.LoadFromFile('C:\1.BMP');
W:=Round(Bitmap.Width*0.8);
H:=Round(Bitmap.Height*0.8);
ZoomImage(Bitmap,W,H);
Image1.Picture.Bitmap:=Bitmap;
end;end.
var
BitMap:TBitMap;
W,H:Integer;
begin
BitMap:=TBitMap.Create;
BitMap.LoadFromFile('C:\1.BMP');
W:=Round(Bitmap.Width*0.8);
H:=Round(Bitmap.Height*0.8);
ZoomImage(Bitmap,W,H);
Bitmap.SaveToFile('C:\2.BMP');//save to...
Image1.Picture.Bitmap:=Bitmap;
end;
Bitmap.Canvas.StretchDraw这个函数就行