For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > January 2006 > Clipping a pic and saving it in a file in DOT NET









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

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

2006-01-30, 7:55 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

Piotr Dobrowolski

2006-01-30, 7:55 am

Dnia 30-01-2006 o 13:09:18 Dixon <vijaydixon@gmail.com> napisał:

> 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)

--
Piotr Dobrowolski
Piotr.Dobrowolski@_usun_gmail.com
Dixon

2006-01-30, 6:55 pm

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]

2006-01-30, 6:55 pm


"Dixon" <vijaydixon@gmail.com> wrote in message
news:1138622958.517469.231480@g47g2000cwa.googlegroups.com...

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

2006-01-30, 6:55 pm

Dnia 30-01-2006 o 15:10:56 Dixon <vijaydixon@gmail.com> napisał:

> 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);


--
Piotr Dobrowolski
Piotr.Dobrowolski@_usun_gmail.com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com