Files
docs-desktop/dotnet-desktop-guide/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-png-image.md
T
Pooja PoojariandAndy De George 6d665a13bd US-1889327: Updated H2 headings. (#1323)
* Updated H2 headings for US-1889327.

* Review edits.

* Apply suggestions from code review

Co-authored-by: Andy (Steve) De George <[email protected]>
2022-03-04 18:48:05 +00:00

1.9 KiB

title, description, ms.date, ms.custom, dev_langs, helpviewer_keywords, ms.assetid
title description ms.date ms.custom dev_langs helpviewer_keywords ms.assetid
How to: Encode and Decode a PNG Image Learn how to Encode and Decode a PNG image. 03/30/2017 devdivchpfy22
csharp
vb
cpp
PNG encoding [WPF]
decoding PNG images [WPF]
PNG decoding [WPF]
encoding image formats [WPF]
decoding image formats [WPF]
encoding PNG images [WPF]
3d31d186-af73-47f0-b5a7-c26ae46409a6

How to: Encode and Decode a PNG Image

The following examples show how to decode and encode a Portable Network Graphics (PNG) image using the specific xref:System.Windows.Media.Imaging.PngBitmapDecoder and xref:System.Windows.Media.Imaging.PngBitmapEncoder objects.

Decode a PNG image

This example demonstrates how to decode a PNG image using a xref:System.Windows.Media.Imaging.PngBitmapDecoder from a xref:System.IO.FileStream.

[!code-cppPngBitmapDecoderEncoder#1] [!code-csharpPngBitmapDecoderEncoder#1] [!code-vbPngBitmapDecoderEncoder#1]

Encode a PNG image

This example demonstrates how to encode a xref:System.Windows.Media.Imaging.BitmapSource into a PNG image using a xref:System.Windows.Media.Imaging.PngBitmapEncoder.

[!code-cppPngBitmapDecoderEncoder#4] [!code-csharpPngBitmapDecoderEncoder#4] [!code-vbPngBitmapDecoderEncoder#4]

See also