728x90
반응형
728x170
using System.IO;
using System.Windows.Media.Imaging;
#region 바이트 배열 구하기 - GetByteArray(bitmapImage)
/// <summary>
/// 바이트 배열 구하기
/// </summary>
/// <param name="bitmapImage">비트맵 이미지</param>
/// <returns>바이트 배열</returns>
public byte[] GetByteArray(BitmapImage bitmapImage)
{
PngBitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bitmapImage));
using(MemoryStream memoryStream = new MemoryStream())
{
encoder.Save(memoryStream);
return memoryStream.ToArray();
}
}
#endregion
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] MediaElement 클래스 : 움직이는 GIF 파일 재생하기 (0) | 2021.02.19 |
---|---|
[C#/WPF] 워드 클라우드(Word Cloud) 이미지 만들기 (0) | 2021.02.19 |
[C#/WPF] 로딩 패널 표시하기 (0) | 2021.02.18 |
[C#/WPF] BitmapImage 클래스 : 바이트 배열에서 비트맵 이미지 구하기 (0) | 2021.02.18 |
[C#/WPF] BitmapSource 클래스 : 바이트 배열에서 비트맵 소스 구하기 (0) | 2021.02.18 |
[C#/WPF] BitmapImage 클래스 : 바이트 배열 구하기 (0) | 2021.02.17 |
[C#/WPF] Slider 엘리먼트 : 커스텀 슬라이더 사용하기 (0) | 2021.02.16 |
[C#/WPF] 진행 컨트롤 사용하기 (0) | 2021.02.16 |
[C#/WPF] VisualStateManager 엘리먼트 : 컨트롤 템플리트 내에서 사용하기 (0) | 2021.02.15 |
[C#/WPF] FlowDocument 클래스 : RTF 파일 로드하기 (0) | 2021.02.15 |
[C#/WPF] FlowDocument 클래스 : RTF 파일을 XAML로 변환하기 (0) | 2021.02.15 |
댓글을 달아 주세요