Clipping a pic and saving it in a file in DOT NET

D

Dixon

Hai

Im a newbie

I have a picture in a picture box

I drag a portion of the picture with the mouse.....

Here i get the area i dragged in and now i want that area to be a
separate picture saved in my hard disk

how do i do that?

i got two (x,y) co-ordinates where i started to drag and where i
finished dragging...

i got the width and height of the portion of the picture

how do i get the actual portion of the picture saved as a separate
file???

can anyone give me the code for that?

thanks in advance
 
P

Piotr Dobrowolski

Dnia 30-01-2006 o 13:09:18 Dixon said:
Hai

Im a newbie

I have a picture in a picture box

I drag a portion of the picture with the mouse.....

Here i get the area i dragged in and now i want that area to be a
separate picture saved in my hard disk

how do i do that?

i got two (x,y) co-ordinates where i started to drag and where i
finished dragging...

i got the width and height of the portion of the picture

how do i get the actual portion of the picture saved as a separate
file???

can anyone give me the code for that?
[PD]
1. Create second Image (Bitmap) with the size of (X2-X1), (Y2-Y1)
2. Create Graphics for it (Graphics.FromImage)
3. Draw correct portion of the source graphic to the destination graphic
(one of the Graphics.DrawImage methods allows you to do that)
4. Save the destination image (Image.Save)
 
D

Dixon

It doesnt work out

how do i set the size of the picture object its read only

my picture object is a bitmap object

?????
 
J

Jeff Johnson [MVP: VB]

Please do not crosspost questions to both .NET and non-.NET groups. The
*.vb.* groups are for VB6 and earlier. All .NET groups have "dotnet" in
their names.
 
P

Piotr Dobrowolski

Dnia 30-01-2006 o 15:10:56 Dixon said:
It doesnt work out

how do i set the size of the picture object its read only

my picture object is a bitmap object
[PD] Bitmap destBitmap = new Bitmap(width,height);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,438
Messages
2,571,699
Members
48,796
Latest member
Greg L.
Top