PixelFormats Class
TOC
Collapse the table of content
Expand the table of content

PixelFormats Class

Represents the collection of supported pixel formats.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public ref class PixelFormats abstract sealed
public final class PixelFormats
public final class PixelFormats
You cannot use this managed class in XAML.

This example shows how to convert an image to grayscale using FormatConvertedBitmap.

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

  <Page.Resources>

    <!-- This resource defines a BitmapImage with a source and a
         DecodePixelWidth of 200. This property is set to the same value 
         as the desired width of the image to save on memory use. This 
         BitmapImage is used as the base for the other BitmapSource resources. -->
    <BitmapImage x:Key="masterImage" DecodePixelWidth="200" 
     UriSource="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water Lilies.jpg"/>

    <!-- This FormatConvertedBitmap uses the BitmapImage defined above and
         changes the format to Gray32 (grayscale). -->
    <FormatConvertedBitmap x:Key="convertFormatImage" Source="{StaticResource masterImage}"
     DestinationFormat="Gray32" />
      
  </Page.Resources>
  
  <StackPanel>
    
    <!-- Apply the "convertFormatImage" resource defined above to this image.  -->
    <Image Width="200" Source="{StaticResource convertFormatImage}" />
  </StackPanel>
</Page>

No code example is currently available or this language may not be supported.

System.Object
  System.Windows.Media.PixelFormats

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2016 Microsoft