using (Stream stream = new MemoryStream(bytes)) { stream.Position = 0; Metafile mimg = new Metafile(stream); using (Stream streamEx = new MemoryStream()) { mimg.Save(streamEx, ImageFormat.Png);//Almost four seconds streamEx.Position = 0; img = new BitmapImage(); img.BeginInit(); img.StreamSource = streamEx; img.CreateOptions = BitmapCreateOptions.IgnoreColorProfile; img.CacheOption = BitmapCacheOption.OnLoad; img.EndInit(); } }
using (Stream stream = new MemoryStream(bytes)) { stream.Position = 0; System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(stream);//Almost three seconds myImg1.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( bitmap.GetHbitmap(), IntPtr.Zero, new Int32Rect(0, 0, RcBill.Width, RcBill.Height), BitmapSizeOptions.FromEmptyOptions()); NativeMethods.DeleteObject(bitmap.GetHbitmap()); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)