BitmapDecoder class

Applies to Windows and Windows Phone

Provides read access to bitmap container data as well as data from the first frame.

Syntax


public sealed class BitmapDecoder : IBitmapFrame

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Members

The BitmapDecoder class has these types of members:

Methods

The BitmapDecoder class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
CreateAsync(Guid, IRandomAccessStream) Asynchronously creates a new BitmapDecoder using a specific bitmap codec and initializes it using a stream.
CreateAsync(IRandomAccessStream) Asynchronously creates a new BitmapDecoder and initializes it using a stream.
GetDecoderInformationEnumerator The bitmap decoders installed on the system and information about them.
GetFrameAsync Asynchronously retrieves a frame from the image file.
GetPixelDataAsync() Asynchronously requests the pixel data for the frame.
GetPixelDataAsync(BitmapPixelFormat, BitmapAlphaMode, BitmapTransform, ExifOrientationMode, ColorManagementMode) Asynchronously requests the pixel data for the frame using the specified parameters.
GetPreviewAsync Asynchronously returns a stream containing the preview image.
GetThumbnailAsync Asynchronously returns a stream containing the thumbnail image.

 

Properties

The BitmapDecoder class has these properties.

PropertyAccess typeDescription

BitmapAlphaMode

Read-onlyThe default alpha mode of the first frame.

BitmapContainerProperties

Read-onlyProvides access to the container bitmap properties.

BitmapPixelFormat

Read-onlyThe pixel format that best fits the first frame.

BitmapProperties

Read-onlyA read-only view of the metadata within the first frame.

BmpDecoderId

Read-onlyThe unique identifier of the BMP decoder.

DecoderInformation

Read-onlyInformation about the bitmap decoder.

DpiX

Read-onlyThe horizontal resolution of the first frame in dots per inch.

DpiY

Read-onlyThe vertical resolution of the first frame in dots per inch.

FrameCount

Read-onlyThe number of frames within the image file.

GifDecoderId

Read-onlyThe unique identifier of the GIF decoder.

IcoDecoderId

Read-onlyThe unique identifier of the ICO decoder.

JpegDecoderId

Read-onlyThe unique identifier of the JPEG decoder.

JpegXRDecoderId

Read-onlyThe unique identifier of the JPEG-XR decoder.

OrientedPixelHeight

Read-onlyThe height of the first frame in pixels, after any EXIF orientation has been applied to the bitmap.

OrientedPixelWidth

Read-onlyThe width of the first frame in pixels, after any EXIF orientation has been applied to the bitmap.

PixelHeight

Read-onlyThe height of the first frame in pixels.

PixelWidth

Read-onlyThe width of the first frame in pixels.

PngDecoderId

Read-onlyThe unique identifier of the PNG decoder.

TiffDecoderId

Read-onlyThe unique identifier of the TIFF decoder.

 

Remarks

Image formats

BitmapDecoder can decode the following formats.

  • JPEG
  • PNG
  • GIF
  • TIFF
  • BMP
  • ICO
  • JPEG-XR
  • Any installed Camera raw formats by using the Microsoft Camera Codec Pack.

For a list of decoding formats, see the BitmapEncoder topic.

The BitmapDecoder class implements IBitmapFrame. It provides access to container data as well as data from the first frame. This allows applications to accomplish most common scenarios without needing to retrieve a separate BitmapFrame.

Examples

Here's a partial example of creating a decoder object. This example assumes you selected a file with Windows.Storage.Pickers.FileOpenPicker. For full instructions on selecting a file, creating an decoder, and decoding an image see How to decode an image


file.openAsync(Windows.Storage.FileAccessMode.readWrite).then(function (_stream) {
        stream = _stream;

        var encoderId;
        switch (fileType) {
            case ".jpg":
                encoderId = Windows.Graphics.Imaging.BitmapEncoder.jpegEncoderId;
                break;
        }
        return Windows.Graphics.Imaging.BitmapEncoder.createAsync(encoderId, stream);
        }).then(function (encoder) {

														// Your code here.
	       }


Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Graphics.Imaging
Windows::Graphics::Imaging [C++]

Metadata

Windows.winmd

 

 

Show:
© 2014 Microsoft