[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

Copy area of image

I have a jpeg image.
How can I copy an area from this picture ?
For example an area with these coord. :
x:=10
y:=10
dx:=100;
dy:=100;
0
ginsonic
Asked:
ginsonic
1 Solution
 
jeurkCommented:
Hi, when your image is already in a TImage. This is not a jpeg question, it is ?

procedure TForm2.FormCreate( Sender: TObject );
{==============================================================================}
var
  aDC: HDC;
begin
  fBMP        := TBitmap.Create;
  fBMP.Width  := Screen.Width;
  fBMP.Height := Screen.Height;
  BitBlt(  fBMP.Canvas.handle, 10, 10, 10+100, 10+100,
          yourImage.Canvas.handle, 100, 100, srcCopy  );
end;


something like that.
0
 
ProbieCommented:
First of all you have to fill a TPicture with the JPEG image, this is done with the line bellow:
(Don't forget that the Jpeg object should be filled with something first)

TPicture.Graphic.Assign(TJpeg);

Then you can work with the TPictures bimap object:

TPicture.Bitmap

Use the canvas property of the Bitmap object

Canvas.CopyRect(Dest: TRect; Canvas: TCanvas; TRect(10, 10, 100, 100 : Integer));


You can fins information about how to work with the canvas in the delphi help.
0
 
ginsonicAuthor Commented:
Can you send me a project ?
My email is nick@radioterra.ro .
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now