728x90
반응형
728x170
using System.IO;
using System.Windows.Media.Imaging;
#region 비트맵 이미지 구하기 - GetBitmapImage(bitmap)
/// <summary>
/// 비트맵 이미지 구하기
/// </summary>
/// <param name="bitmap">비트맵</param>
/// <returns>비트맵 이미지</returns>
public BitmapImage GetBitmapImage(System.Drawing.Bitmap bitmap)
{
using MemoryStream stream = new MemoryStream();
bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
stream.Position = 0;
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
bitmapImage.StreamSource = stream;
bitmapImage.EndInit();
bitmapImage.Freeze();
return bitmapImage;
}
#endregion
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] 3D 애니메이션 시계 사용하기 (절전 모드 방지 기능 추가) (0) | 2021.11.17 |
---|---|
[C#/WPF] DataGrid 클래스 : 데이터 업데이트 성능 측정하기 (0) | 2021.10.22 |
[C#/WPF] DataGrid 클래스 : 대용량 데이터 바인딩하기 (0) | 2021.10.03 |
[C#/WPF/.NETCORE] FaceDetector 클래스 : DetectFacesAsync 메소드를 사용해 얼굴 탐지하기 (0) | 2021.09.23 |
[C#/WPF/.NETCORE] 누겟 설치 : Microsoft.Windows.SDK.Contracts (0) | 2021.09.23 |
[C#/WPF/.NETCORE] IValueConverter 인터페이스 : 비트맵→비트맵 소스 변환자 사용하기 (0) | 2021.09.23 |
[C#/WPF] ICommand 인터페이스 : 릴레이 명령 사용하기 (0) | 2021.09.23 |
[C#/WPF] ICommand 인터페이스 : 매개 변수를 갖는 대리자 명령 사용하기 (0) | 2021.09.23 |
[C#/WPF] ICommand 인터페이스 : 대리자 명령 사용하기 (0) | 2021.09.23 |
[C#/WPF] ComboBox 클래스 : 우선 순위 필터 콤보 박스 사용하기 (0) | 2021.09.17 |
댓글을 달아 주세요