Simple editing image lazarus / 39-Graphics ---------------------------------------------------------------------- xinyiman · 2012-07-20 13:16 Hello guys, how can I extract a portion of the image contained within a TPicture? In order to save it then as I want it cut?! ---------------------------------------------------------------------- KpjComp · 2012-07-20 14:02 Something like this should do.  Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var   b:TBitmap; begin   //lets copy a 100 by 100 pixels, at offset 100,100 from a TImage   b := TBitmap.Create;   try     b.Width := 100;     b.height := 100;     b.canvas.draw(-100,-100,image1.Picture.Graphic);     b.SaveToFile('d:\temp.bmp');   finally     b.free;   end; end; ---------------------------------------------------------------------- xinyiman · 2012-07-21 16:00 Thanks, it works. But now I need to know one more thing. I imported the image I have set the TImage object with Proportional:=TRUE and I centered the image. How do I know the proportions of the image you just loaded (which is smaller than the image file). thanks ---------------------------------------------------------------------- KpjComp · 2012-07-23 09:46 QuoteHow do I know the proportions of the image Well the proportions of the image are always the same whatever the size, if Proportional is set. I assume you mean what are the dimensions on the image on screen? If so there is a protected method called DestRect, to get at the protected method we can use a Cracker Class.  Here is an example -> Code: [Select]type   TCustomImageCrack = class(TCustomImage)   end; { TForm1 } procedure TForm1.Button1Click(Sender: TObject); var   dr:TRect; begin   dr := TCustomImageCrack(image1).destrect;   showmessage(format('Width=%d, Height=%d',[dr.Right- dr.left,dr.Bottom-dr.top])); end;