coolpjmartin
Member
- Joined
- Aug 8, 2006
- Messages
- 9
- Programming Experience
- Beginner
Help wanted clipping an image region and saving as new image....
Can someone please help me.
What I what to do is display a picture (image) and drawer a clip region using the mouse on a selected area on the image, this could be a retangle, square or a freehand shape.
I can display the image and clipped region using WPF as below. But what I cannot work out is how to save the clipped region of the image as a new bitmap image. The same problem if I create a image using pathgeometry, I cannot work out how to save the cropped part of the image.
If there is an alternative method instead of using WPF, please advice me.
Thanks
Can someone please help me.
What I what to do is display a picture (image) and drawer a clip region using the mouse on a selected area on the image, this could be a retangle, square or a freehand shape.
I can display the image and clipped region using WPF as below. But what I cannot work out is how to save the clipped region of the image as a new bitmap image. The same problem if I create a image using pathgeometry, I cannot work out how to save the cropped part of the image.
If there is an alternative method instead of using WPF, please advice me.
Thanks
VB.NET:
Dim myImage As Image = New Image
Dim imageUri As Uri = New Uri("C:\\Documents and Settings\\All Users\\Documents\My Pictures\\Sample Pictures\\Water lilies.jpg", UriKind.Relative)
myImage.Source = New BitmapImage(imageUri)
myImage.Width = 200
myImage.Height = 150
myImage.HorizontalAlignment = HorizontalAlignment.Left
Dim myEllipseGeometry2 As EllipseGeometry = New EllipseGeometry
myEllipseGeometry2.Center = New Point(100, 75)
myEllipseGeometry2.RadiusX = 100
myEllipseGeometry2.RadiusY = 75
myImage.Clip = myEllipseGeometry2
Last edited by a moderator: