• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Convert BitmapImage to Bitmap?

#2
Just curious, why are you trying to do that? Perhaps there are WPF classes that can do what you're looking for?

In any case, WPF doe not have a way to natively convert BitmapSources to Bitmaps. You need to manually do this by calling CopyPixels, and creating a Bitmap with the image bits.

-----Original Message-----
From: [email protected]
Posted At: Wednesday, May 17, 2006 6:43 AM
Posted To: microsoft.public.windows.developer.winfx.avalon
Conversation: Convert BitmapImage to Bitmap?
Subject: Convert BitmapImage to Bitmap?


How I can convert from System.Windows.Media.Imaging.BitmapImage(Avalon
bitmap) to System.Drawing.Bitmap (.net Bitmap)?
 

My Computer

Posts
1
#4
ImageSource to Bitmap

MemoryStream mse = new MemoryStream();
System.Windows.Media.Imaging.
BmpBitmapEncoder e = new BmpBitmapEncoder();
e.Frames.Add(
BitmapFrame.Create(imageSource_bitmapSource));
e.Save(mse);

WIC Rocks!
 

My Computer