Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BitmapImage BitmapToImageSource(System.Drawing.Bitmap bitmap, System.Drawing.Imaging.ImageFormat imgFormat)
- {
- using (MemoryStream memory = new MemoryStream())
- {
- bitmap.Save(memory, imgFormat);
- memory.Position = 0;
- BitmapImage bitmapImage = new BitmapImage();
- bitmapImage.BeginInit();
- bitmapImage.StreamSource = memory;
- bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
- bitmapImage.EndInit();
- return bitmapImage;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement