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;
LVL 9
ginsonicAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ginsonicAuthor Commented:
Can you send me a project ?
My email is nick@radioterra.ro .
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.