Defines an encoder that is used to encode Microsoft Windows Media Photo images.
Assembly: PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Thetype exposes the following members.
|AlphaDataDiscardLevel||Gets or sets the level of alpha frequency data to discard during a compressed domain transcode.|
|AlphaQualityLevel||Gets or sets the compression quality for a planar alpha channel.|
|CodecInfo||Gets information that describes this codec. (Inherited from BitmapEncoder.)|
|ColorContexts||Gets or sets a value that represents the color profile that is associated with this encoder. (Inherited from BitmapEncoder.)|
|CompressedDomainTranscode||Gets or sets a value that indicates whether compressed domain operations can be used. Compressed domain operations are transformation operations that are done without decoding the image data.|
|Dispatcher||Gets the Dispatcher this DispatcherObject is associated with. (Inherited from DispatcherObject.)|
|FlipHorizontal||Gets or sets a value indicating whether to flip the image horizontally.|
|FlipVertical||Gets or sets a value that indicates whether to flip the image vertically.|
|Frames||Gets or sets the individual frames within an image. (Inherited from BitmapEncoder.)|
|FrequencyOrder||Gets or sets a value that indicates whether to encoding in frequency order.|
|HorizontalTileSlices||Gets or sets the number of horizontal divisions to use during compression encoding. A single division creates two horizontal regions.|
|IgnoreOverlap||Gets or sets a value that indicates whether to ignore region overlap pixels in subregion compressed domain encoding. This feature is not currently implemented.|
|ImageDataDiscardLevel||Gets or sets the level of image data to discard during a compressed domain transcode.|
|ImageQualityLevel||Gets or sets the image quality level.|
|InterleavedAlpha||Gets or sets a value that indicates whether to encode the alpha channel data as an additional interleaved channel.|
|Lossless||Gets or sets a value that indicates whether to encode using lossless compression.|
|Metadata||Gets or sets the metadata that will be associated with this bitmap during encoding. (Inherited from BitmapEncoder.)|
|OverlapLevel||Gets or sets the overlap processing level.|
|Palette||Gets or sets a value that represents the BitmapPalette of an encoded bitmap. (Inherited from BitmapEncoder.)|
|Preview||Gets or sets a BitmapSource that represents the global preview of a bitmap, if there is one. (Inherited from BitmapEncoder.)|
|QualityLevel||Gets or sets the compression quality for the main image.|
|Rotation||Gets or sets the Rotation of the image.|
|SubsamplingLevel||Gets or sets the sub-sampling level for RGB image encoding.|
|Thumbnail||Gets or sets a BitmapSource that represents the global embedded thumbnail. (Inherited from BitmapEncoder.)|
|UseCodecOptions||Gets or sets a value that indicates codec options are to be used.|
|VerticalTileSlices||Gets or sets the number of vertical divisions to use during compression encoding. A single division creates two vertical regions.|
|CheckAccess||Determines whether the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.)|
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|Save||Encodes a bitmap image to a specified Stream. (Inherited from BitmapEncoder.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
|VerifyAccess||Enforces that the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.)|
Windows Media Photo is a new codec that provides better image fidelity than JPEG with smaller file sizes and more features. Windows Media Photo images achieve lossy and lossless compression by using a single algorithm. Windows Media Photo images support existing metadata standards. For additional information about this format, see Windows Media Photo Specification.
Windows Media Photo files do not support preview, global thumbnails, frame level thumbnails, or multiple frames.
Encoding does not work in partial trust. See WPF Partial Trust Security for information on partial trust.
The following examples show how to decode and encode a Microsoft Windows Media Photo image using the specific WmpBitmapDecoder and objects.
// Open a Stream and decode a WDP image Stream imageStreamSource = new FileStream("tulipfarm.wdp", FileMode.Open, FileAccess.Read, FileShare.Read); WmpBitmapDecoder decoder = new WmpBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); BitmapSource bitmapSource = decoder.Frames; // Draw the Image Image myImage = new Image(); myImage.Source = bitmapSource; myImage.Stretch = Stretch.None; myImage.Margin = new Thickness(20);
This example demonstrates how to encode a BitmapSource into a Windows Media Photo image using a .
int width = 128; int height = width; int stride = width / 8; byte pixels = new byte[height * stride]; // Define the image palette BitmapPalette myPalette = BitmapPalettes.WebPalette; // Creates a new empty image with the pre-defined palette BitmapSource image = BitmapSource.Create( width, height, 96, 96, PixelFormats.Indexed1, myPalette, pixels, stride); FileStream stream = new FileStream("new.wdp", FileMode.Create); WmpBitmapEncoder encoder = new WmpBitmapEncoder(); TextBlock myTextBlock = new TextBlock(); myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString(); encoder.Frames.Add(BitmapFrame.Create(image)); encoder.Save(stream);
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.