728x90
반응형
728x170
using System.IO;
using System.Windows.Media.Imaging;
#region PNG 파일 저장하기 - SavePNGFile(bitmapSource, filePath, pngInterlaceOption)
/// <summary>
/// PNG 파일 저장하기
/// </summary>
/// <param name="bitmapSource">비트맵 소스</param>
/// <param name="filePath">파일 경로</param>
/// <param name="pngInterlaceOption">PNG 인터레이스 옵션</param>
public void SavePNGFile(BitmapSource bitmapSource, string filePath, PngInterlaceOption pngInterlaceOption)
{
PngBitmapEncoder pngBitmapEncoder = new PngBitmapEncoder();
pngBitmapEncoder.Interlace = pngInterlaceOption;
pngBitmapEncoder.Frames.Add(BitmapFrame.Create(bitmapSource));
using(FileStream fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write))
{
pngBitmapEncoder.Save(fileStream);
}
}
#endregion
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] Panel 클래스 : ZIndex 속성 사용하기 (0) | 2014.02.22 |
---|---|
[C#/WPF] 프로그램 로딩 시간 대처하기 (0) | 2014.02.21 |
[C#/WPF] Binding 클래스 : 바인딩 설정하기 (0) | 2014.02.21 |
[C#/WPF] RenderTargetBitmap 클래스 : FrameworkElement 객체에서 비트맵 구하기 (0) | 2014.02.21 |
[C#/WPF] BitmapSource 클래스 : TIFF 파일 저장하기 (0) | 2014.02.21 |
[C#/WPF] 픽셀 스냅(Pixel Snap) 사용하기 (0) | 2014.02.21 |
[C#/WPF] GridViewColumn 클래스 : 바인딩 설정하기 (0) | 2014.02.21 |
[C#/WPF] Window 클래스 : 윈도우 객체 핸들 구하기 (0) | 2014.02.21 |
[C#/WPF] Window 클래스 : 시스템 메뉴 숨기기 (0) | 2014.02.21 |
[C#/WPF] Dispatcher 클래스 : Invoke 메소드를 사용해 크로스 스레드(Cross Thread) 처리하기 (0) | 2014.02.21 |
댓글을 달아 주세요