Unit Unit1;
Interface
Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,jpeg, ExtCtrls;
Type
TForm1 = class(TForm)
Image1: TImage;
Procedure thumb(pic,dest:string;h,w:integer);
Procedure FormCreate(Sender: TObject);
End;
Var
Form1: TForm1;
Implementation
{$R *.dfm}
Procedure Tform1.thumb(pic,dest:string;h,w:integer);
Var
bmp: TBitmap;
Begin
With TImage.Create(nil) Do
Begin
Try
Picture.LoadFromFile(pic);
bmp := TBitmap.Create;
bmp.Height := w;
bmp.Width := h;
bmp.Canvas.StretchDraw(Rect(0,0,Bmp.Width,Bmp.Height), Picture.Graphic);
bmp.SaveToFile(dest);
Finally
bmp.Free;
End;
End;
End;
Procedure TForm1.FormCreate(Sender: TObject);
Begin
form1.thumb('C:\bild1.jpg',
'C:\thumb.jpg',150,150);
End;
End.