How to resize proportionally an image in canvas form lazarus / 39-Graphics ---------------------------------------------------------------------- Christian_uy · 2013-06-23 16:54 Hello evrebody I have this code take from the tutorial nº 2 procedure TForm1.FormPaint(Sender: TObject); var stretched: TBGRABitmap; begin     stretched := image.Resample(ClientWidth, ClientHeight) as TBGRABitmap;     stretched.Draw(Canvas,0,0,True);     stretched.Free;     //image.Draw(Canvas,0,0,True); end; but loose proportions. I don't care if image does not cover the entire form in both width and length directions. ¿ Anyone know if there is a property similar to the property Stretch in the TImage class or a method that can do that ? Thanks Christian. ---------------------------------------------------------------------- exdatis · 2013-06-23 18:13 See: http://forum.lazarus.freepascal.org/index.php/topic,20709.msg120369.ht ml#msg120369 Regards p.s. set: original_with * rescaleVal, original_height * rescaleVal (e.g rescaleValue = 1.2 //20%) ---------------------------------------------------------------------- exdatis · 2013-06-23 18:28 You can find in examples, this procedure(very useful): ------------ procedure TForm1.RescaleImage(newScale: Double); var   OrgWidth, OrgHeight: integer;   Rect: TRect; begin   OrgWidth := Image1.Picture.Bitmap.Width;   OrgHeight := Image1.Picture.Bitmap.Height;   FImageScale := FImageScale * NewScale; //FImageScale-> private 1.0 on start(original)   Rect := Image1.BoundsRect;   Rect.Right := Rect.Left + Round(OrgWidth * FImageScale);   Rect.Bottom := Rect.Top + Round(OrgHeight * FImageScale);   Image1.Align := AlNone;   Image1.BoundsRect := Rect;   Image1.Stretch:= true;   //strech end; ---------------------------------------------------------------------- Christian_uy · 2013-06-25 03:12 Thanks for the fast reply Exdatis!. I'll be trying this as soon as possible.