Export (0) Print
Expand All

WmpBitmapEncoder Class

Defines an encoder that is used to encode Microsoft Windows Media Photo images.

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

public sealed class WmpBitmapEncoder : BitmapEncoder
public final class WmpBitmapEncoder extends BitmapEncoder
public final class WmpBitmapEncoder extends BitmapEncoder
<WmpBitmapEncoder .../>

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 the Windows Media Photo Specification.

files do not support preview, global thumbnails, frame level thumbnails, or multiple frames.

Encoding does not work in partial trust. See the Windows Presentation Foundation Partial Trust Programming topic for information on partial trust.

The following example demonstrates how to use the WmpBitmapEncoder to encode a new bitmap image.

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);

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:
© 2014 Microsoft