I am using following code to get source for image in wpf (image is of type System.Windows.Controls.Image). I want to store this image to disk with it original extension, is it possible?
System.drawing.image provides save method is there something like that for System.windows.controls.image?
Image image=new Image();
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri(openFileDlg.FileName);
bitmap.EndInit();
image.Source = bitmap;
Take a look at RenderTargetBitmap and BitmapEncoder classes.
The following utility class allows you to save your
Imageas raster graphics image, according to the chosen format:And you can use it to save your
Image, or any otherFrameworkElement: