CSharp examples for System.Windows.Media.Imaging:BitmapSource
Get Image Source from Bitmap
using System.Windows.Media.Imaging; using System.Windows.Media; using System.Windows.Data; using System.Windows; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from w ww. j a v a 2 s. c o m*/ public class Main{ public static ImageSource GetImageSource(this System.Drawing.Bitmap image) { BitmapSource destination; IntPtr bitmapHandle = image.GetHbitmap(); BitmapSizeOptions sizeOptions = BitmapSizeOptions.FromEmptyOptions(); destination = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(bitmapHandle, IntPtr.Zero, Int32Rect.Empty, sizeOptions); destination.Freeze(); return destination; } }