--- title: "How to: Encode and decode a JPEG image" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" - "cpp" helpviewer_keywords: - "encoding image formats [WPF]" - "decoding JPEG images [WPF]" - "encoding JPEG images [WPF]" - "decoding image formats [WPF]" - "JPEG decoding [WPF]" - "JPEG encoding [WPF]" ms.assetid: b8cfde37-9f68-4911-a05e-51d8d7bdec7b --- # How to: Encode and decode a JPEG image The following examples show how to decode and encode a JPEG image using the specific and objects. ## Example - Decode a JPEG image This example demonstrates how to decode a JPEG image using a from a . [!code-cpp[JpegBitmapDecoderEncoder#1](~/samples/snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/jpegencoderdecoder.cpp#1)] [!code-csharp[JpegBitmapDecoderEncoder#1](~/samples/snippets/csharp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CSharp/JpegEncoderDecoder.cs#1)] [!code-vb[JpegBitmapDecoderEncoder#1](~/samples/snippets/visualbasic/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/VB/JpegEncoderDecoder.vb#1)] ## Example - Encode a JPEG image This example demonstrates how to encode a into a JPEG image using a . [!code-cpp[JpegBitmapDecoderEncoder#4](~/samples/snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/jpegencoderdecoder.cpp#4)] [!code-csharp[JpegBitmapDecoderEncoder#4](~/samples/snippets/csharp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CSharp/JpegEncoderDecoder.cs#4)] [!code-vb[JpegBitmapDecoderEncoder#4](~/samples/snippets/visualbasic/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/VB/JpegEncoderDecoder.vb#4)] ## See also - [Imaging Overview](imaging-overview.md)