--- title: "How to: Convert a BitmapSource to an Indexed Pixel Format" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "pixel format [WPF], palettized" - "graphics [WPF], converting BitmapSource objects to indexed pixel format" - "BitmapSource objects [WPF], converting to indexed pixel format" - "palettized pixel format [WPF]" - "indexed pixel format [WPF]" - "pixel format [WPF], indexed" - "graphics [WPF], converting BitmapSource objects to palettized pixel format" - "converting [WPF], BitmapSource objects to indexed pixel formats" - "converting [WPF], BitmapSource objects to palettized pixel format" - "BitmapSource objects [WPF], converting to palettized pixel format" ms.assetid: ccb03a83-8c72-4353-89da-48312d16548b --- # How to: Convert a BitmapSource to an Indexed Pixel Format This example shows how to convert a to an indexed pixel format. ## Example [!code-csharp[ImagingSnippetGallery_procedural_snip#FormatConvertedBitmapCodeExample2WholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/ImagingSnippetGallery_procedural_snip/CSharp/FormatConvertedBitmapExample2.cs#formatconvertedbitmapcodeexample2wholepage)] [!code-vb[ImagingSnippetGallery_procedural_snip#FormatConvertedBitmapCodeExample2WholePage](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ImagingSnippetGallery_procedural_snip/VB/FormatConvertedBitmapExample2.vb#formatconvertedbitmapcodeexample2wholepage)]