Files
docs-desktop/dotnet-desktop-guide/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-wdp-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

39 lines
2.0 KiB
Markdown

---
title: "How to: Encode and Decode a WDP Image"
description: Learn how to Encode and Decode a WDP image.
ms.date: "03/30/2017"
ms.custom: devdivchpfy22
dev_langs:
- "csharp"
- "vb"
- "cpp"
helpviewer_keywords:
- "WDP encoding [WPF]"
- "WDP decoding [WPF]"
- "encoding image formats [WPF]"
- "decoding WDP images [WPF]"
- "decoding image formats [WPF]"
- "encoding WDP images [WPF]"
ms.assetid: 911777d1-516b-49db-a87b-b54e31b18532
---
# How to: Encode and Decode a WDP Image
The following examples show how to decode and encode a Microsoft Windows Media Photo image using the specific <xref:System.Windows.Media.Imaging.WmpBitmapDecoder> and <xref:System.Windows.Media.Imaging.WmpBitmapEncoder> objects.
## Decode a Windows Media Photo image
This example demonstrates how to decode a Windows Media Photo image using a <xref:System.Windows.Media.Imaging.WmpBitmapDecoder> from a <xref:System.Uri>.
[!code-cpp[WdpBitmapDecoderEncoder#1](~/samples/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/WDPEncoderDecoder.cpp#1)]
[!code-csharp[WdpBitmapDecoderEncoder#1](~/samples/snippets/csharp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CSharp/WDPEncoderDecoder.cs#1)]
[!code-vb[WdpBitmapDecoderEncoder#1](~/samples/snippets/visualbasic/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/VB/WDPEncoderDecoder.vb#1)]
## Encode a Windows Media Photo image
This example demonstrates how to encode a <xref:System.Windows.Media.Imaging.BitmapSource> into a Windows Media Photo image using a <xref:System.Windows.Media.Imaging.WmpBitmapEncoder>.
[!code-cpp[WdpBitmapDecoderEncoder#4](~/samples/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/WDPEncoderDecoder.cpp#4)]
[!code-csharp[WdpBitmapDecoderEncoder#4](~/samples/snippets/csharp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CSharp/WDPEncoderDecoder.cs#4)]
[!code-vb[WdpBitmapDecoderEncoder#4](~/samples/snippets/visualbasic/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/VB/WDPEncoderDecoder.vb#4)]
## See also
- [Imaging Overview](imaging-overview.md)