728x90
728x170
using System.Windows.Media.Imaging;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
public BitmapImage Convert(Image image)
{
using (var memoryStream = new MemoryStream())
{
image.Save(memoryStream , ImageFormat.Png);
memory.Position = 0;
var bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
bitmapImage.StreamSource = memoryStream ;
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
bitmapImage.EndInit();
return bitmapImage;
}
}
728x90
그리드형
'C# > WPF' 카테고리의 다른 글
[WPF] Action 비동기 수행하기 (0) | 2022.04.01 |
---|---|
[WPF] DevExpress 컨트롤 이용한 Waiting/Progress Dialog 띄우기 (0) | 2022.03.21 |
[WPF] Command snippet (자작) (0) | 2021.12.16 |
[WPF] Control to Image (0) | 2021.12.14 |
[WPF] ImageSource 를 jpg 로 저장하기 (0) | 2021.12.03 |