Windows desktop applications
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

BitmapDecoder class

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

Syntax


Public NotInheritable Class BitmapDecoder
    Implements IBitmapFrame

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.
GetSoftwareBitmapAsync Asynchronously gets a SoftwareBitmap representation of the decoded bitmap.
GetSoftwareBitmapAsync(BitmapPixelFormat,BitmapAlphaMode) Asynchronously gets a SoftwareBitmap representation of the decoded bitmap.
GetSoftwareBitmapAsync(BitmapPixelFormat,BitmapAlphaMode,BitmapTransform,ExifOrientationMode,ColorManagementMode) Asynchronously gets a SoftwareBitmap representation of the decoded bitmap.
GetThumbnailAsync Asynchronously returns a stream containing the thumbnail image.

 

Properties

The BitmapDecoder class has these properties.

PropertyAccess typeDescription

BitmapAlphaMode

Read-only

The default alpha mode of the first frame.

BitmapContainerProperties

Read-only

Provides access to the container bitmap properties.

BitmapPixelFormat

Read-only

The pixel format that best fits the first frame.

BitmapProperties

Read-only

A read-only view of the metadata within the first frame.

BmpDecoderId

Read-only

The unique identifier of the BMP decoder.

DecoderInformation

Read-only

Information about the bitmap decoder.

DpiX

Read-only

The horizontal resolution of the first frame in dots per inch.

DpiY

Read-only

The vertical resolution of the first frame in dots per inch.

FrameCount

Read-only

The number of frames within the image file.

GifDecoderId

Read-only

The unique identifier of the GIF decoder.

IcoDecoderId

Read-only

The unique identifier of the ICO decoder.

JpegDecoderId

Read-only

The unique identifier of the JPEG decoder.

JpegXRDecoderId

Read-only

The unique identifier of the JPEG-XR decoder.

OrientedPixelHeight

Read-only

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

OrientedPixelWidth

Read-only

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

PixelHeight

Read-only

The height of the first frame in pixels.

PixelWidth

Read-only

The width of the first frame in pixels.

PngDecoderId

Read-only

The unique identifier of the PNG decoder.

TiffDecoderId

Read-only

The 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 Imaging


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 (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

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

Attributes

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

See also

Object
IBitmapFrame
Animated GIF playback (XAML) sample (Windows 10)
OCR sample (Windows 10)
Camera resolution sample (Windows 10)
Basic camera app sample (Windows 10)
Video stabilization sample (Windows 10)
Camera face detection sample (Windows 10)
Manual camera controls sample (Windows 10)
High dynamic range sample (Windows 10)

 

 

Show:
© 2016 Microsoft