Groups | Blog | Home
all groups > dotnet faqs > january 2006 >

dotnet faqs : Clipping a pic and saving it in a file in DOT NET


Dixon
1/30/2006 4:09:18 AM
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
Dixon
1/30/2006 6:10:56 AM
It doesnt work out

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

my picture object is a bitmap object

?????
Jeff Johnson [MVP: VB]
1/30/2006 9:24:29 AM

[quoted text, click to view]

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.

Piotr Dobrowolski
1/30/2006 2:16:19 PM
Dnia 30-01-2006 o 13:09:18 Dixon <vijaydixon@gmail.com> napisa³:

[quoted text, click to view]
[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)

--
Piotr Dobrowolski
Piotr Dobrowolski
1/30/2006 4:11:27 PM
Dnia 30-01-2006 o 15:10:56 Dixon <vijaydixon@gmail.com> napisa³:

[quoted text, click to view]
[PD] Bitmap destBitmap = new Bitmap(width,height);


--
Piotr Dobrowolski
AddThis Social Bookmark Button