Bitmap​Frame Bitmap​Frame Bitmap​Frame Class

Definition

Provides read access to data within a single frame.

public : sealed class BitmapFrame : IBitmapFrame, IBitmapFrameWithSoftwareBitmappublic sealed class BitmapFrame : IBitmapFrame, IBitmapFrameWithSoftwareBitmapPublic NotInheritable Class BitmapFrame Implements IBitmapFrame, IBitmapFrameWithSoftwareBitmap
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Properties

BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode

The default alpha mode of the frame.

public : BitmapAlphaMode BitmapAlphaMode { get; }public BitmapAlphaMode BitmapAlphaMode { get; }Public ReadOnly Property BitmapAlphaMode As BitmapAlphaMode
Value
BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode

The default alpha mode of the frame.

Attributes

Remarks

This is the alpha mode used when calling the GetPixelDataAsync method.

BitmapPixelFormat BitmapPixelFormat BitmapPixelFormat

The pixel format that best fits the frame.

public : BitmapPixelFormat BitmapPixelFormat { get; }public BitmapPixelFormat BitmapPixelFormat { get; }Public ReadOnly Property BitmapPixelFormat As BitmapPixelFormat
Value
BitmapPixelFormat BitmapPixelFormat BitmapPixelFormat

The pixel format that best fits the first frame.

Attributes

Remarks

This is the pixel format used when calling the GetPixelDataAsync method.

BitmapProperties BitmapProperties BitmapProperties

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

public : BitmapPropertiesView BitmapProperties { get; }public BitmapPropertiesView BitmapProperties { get; }Public ReadOnly Property BitmapProperties As BitmapPropertiesView
Value
BitmapPropertiesView BitmapPropertiesView BitmapPropertiesView

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

Attributes

DpiX DpiX DpiX

The horizontal resolution of the frame in dots per inch.

public : double DpiX { get; }public double DpiX { get; }Public ReadOnly Property DpiX As double
Value
double double double

The horizontal resolution of the frame in dots per inch.

Attributes

DpiY DpiY DpiY

The vertical resolution of the frame in dots per inch.

public : double DpiY { get; }public double DpiY { get; }Public ReadOnly Property DpiY As double
Value
double double double

The vertical resolution of the frame in dots per inch.

Attributes

OrientedPixelHeight OrientedPixelHeight OrientedPixelHeight

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

public : unsigned short OrientedPixelHeight { get; }public uint OrientedPixelHeight { get; }Public ReadOnly Property OrientedPixelHeight As uint
Value
unsigned short uint uint

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

Attributes

Remarks

Use this property if you need to know the height of an image or of pixel data that has EXIF orientation applied, for example, if you call GetPixelDataAsync and specify RespectExifOrientation. Also, the HTML img element in Windows app using JavaScript, and Windows.UI.Xaml.Controls.Image respect EXIF orientation.

If you need pixel dimensions of the image as it is natively stored, use the PixelHeight property.

OrientedPixelWidth OrientedPixelWidth OrientedPixelWidth

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

public : unsigned short OrientedPixelWidth { get; }public uint OrientedPixelWidth { get; }Public ReadOnly Property OrientedPixelWidth As uint
Value
unsigned short uint uint

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

Attributes

Remarks

Use this property in the same way as OrientedPixelWidth is used if you need to know the width of an image or of pixel data.

PixelHeight PixelHeight PixelHeight

The height of the frame in pixels.

public : unsigned short PixelHeight { get; }public uint PixelHeight { get; }Public ReadOnly Property PixelHeight As uint
Value
unsigned short uint uint

The height of the frame in pixels.

Attributes

Remarks

If you need pixel dimensions of the image as it is natively stored, use the PixelHeight property.

PixelWidth PixelWidth PixelWidth

The width of the frame in pixels.

public : unsigned short PixelWidth { get; }public uint PixelWidth { get; }Public ReadOnly Property PixelWidth As uint
Value
unsigned short uint uint

The width of the frame in pixels.

Attributes

Remarks

If you need pixel dimensions of the image as it is natively stored, use the PixelWidth property.

Methods

GetPixelDataAsync() GetPixelDataAsync() GetPixelDataAsync()

Asynchronously requests the pixel data for the frame. The resulting pixel data array will use the bitmap pixel format and alpha mode specified in the BitmapPixelFormat and BitmapAlphaMode properties. It will also have color management and EXIF orientation applied (see the Remarks section for more information).

public : IAsyncOperation<PixelDataProvider> GetPixelDataAsync()public IAsyncOperation<PixelDataProvider> GetPixelDataAsync()Public Function GetPixelDataAsync() As IAsyncOperation( Of PixelDataProvider )
Returns

Object that manages the asynchronous retrieval of the pixel data.

Attributes

Remarks

The pixel data array will use the bitmap pixel format and alpha mode specified in the BitmapPixelFormat and BitmapAlphaMode properties. It will also have color management and EXIF orientation applied.

As a convenience, this method performs color management from the frame’s embedded color space (if it exists) to the sRGB color space. If there is no embedded color profile data, then no color management is performed. This method also attempts to read the EXIF orientation flag on the frame, and if it exists, will perform the necessary transformation to correctly orient the pixel data.

In order to retrieve the correct bitmap pixel width and height, the application should read the OrientedPixelWidth and OrientedPixelHeight properties, instead of the PixelWidth and PixelHeight properties.

This method is equivalent to calling the GetPixelDataAsync(BitmapPixelFormat, BitmapAlphaMode, BitmapTransform, ExifOrientationMode, ColorManagementMode) method with the following arguments:

ArgumentValue
pixelFormatThe value of the BitmapPixelFormat property.
alphaModeThe value of the BitmapAlphaMode property
transformAn empty transform.
exifOrientationModeThe ExifOrientationMode value RespectExifOrientation.
colorManagementModeThe ColorManagementMode value ColorManageToSRgb.

See Also

GetPixelDataAsync(BitmapPixelFormat, BitmapAlphaMode, BitmapTransform, ExifOrientationMode, ColorManagementMode) GetPixelDataAsync(BitmapPixelFormat, BitmapAlphaMode, BitmapTransform, ExifOrientationMode, ColorManagementMode) GetPixelDataAsync(BitmapPixelFormat, BitmapAlphaMode, BitmapTransform, ExifOrientationMode, ColorManagementMode)

Asynchronously requests the pixel data for the frame using the specified parameters.

public : IAsyncOperation<PixelDataProvider> GetPixelDataAsync(BitmapPixelFormat pixelFormat, BitmapAlphaMode alphaMode, BitmapTransform transform, ExifOrientationMode exifOrientationMode, ColorManagementMode colorManagementMode)public IAsyncOperation<PixelDataProvider> GetPixelDataAsync(BitmapPixelFormat pixelFormat, BitmapAlphaMode alphaMode, BitmapTransform transform, ExifOrientationMode exifOrientationMode, ColorManagementMode colorManagementMode)Public Function GetPixelDataAsync(pixelFormat As BitmapPixelFormat, alphaMode As BitmapAlphaMode, transform As BitmapTransform, exifOrientationMode As ExifOrientationMode, colorManagementMode As ColorManagementMode) As IAsyncOperation( Of PixelDataProvider )
Parameters
pixelFormat
BitmapPixelFormat BitmapPixelFormat BitmapPixelFormat

The specified pixel format.

alphaMode
BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode

The specified alpha mode.

transform
BitmapTransform BitmapTransform BitmapTransform

The set of transformations to be applied to the frame.

exifOrientationMode
ExifOrientationMode ExifOrientationMode ExifOrientationMode

Indicates whether the EXIF orientation flag should be ignored or respected.

colorManagementMode
ColorManagementMode ColorManagementMode ColorManagementMode

Indicates whether the pixel data should be color managed to the sRGB color space.

Returns

Object that manages the asynchronous retrieval of the pixel data.

Attributes

Remarks

This method should be used instead of GetPixelDataAsync if the application needs finer grained control over the pixel data array.

If you set the exifOrientationMode parameter to RespectExifOrientation, the resulting pixel data will have dimensions that are defined by OrientedPixelWidth and OrientedPixelHeight instead of the PixelWidth and PixelHeight. If you are also applying a transformation, refer to BitmapTransform for information about correctly handling coordinate spaces.

See Also

GetSoftwareBitmapAsync() GetSoftwareBitmapAsync() GetSoftwareBitmapAsync()

GetSoftwareBitmapAsync(BitmapPixelFormat, BitmapAlphaMode) GetSoftwareBitmapAsync(BitmapPixelFormat, BitmapAlphaMode) GetSoftwareBitmapAsync(BitmapPixelFormat, BitmapAlphaMode)

Asynchronously gets a SoftwareBitmap representation of the bitmap frame.

public : IAsyncOperation<SoftwareBitmap> GetSoftwareBitmapAsync(BitmapPixelFormat pixelFormat, BitmapAlphaMode alphaMode)public IAsyncOperation<SoftwareBitmap> GetSoftwareBitmapAsync(BitmapPixelFormat pixelFormat, BitmapAlphaMode alphaMode)Public Function GetSoftwareBitmapAsync(pixelFormat As BitmapPixelFormat, alphaMode As BitmapAlphaMode) As IAsyncOperation( Of SoftwareBitmap )
Parameters
pixelFormat
BitmapPixelFormat BitmapPixelFormat BitmapPixelFormat

The pixel format of the software bitmap.

alphaMode
BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode

The alpha mode of the software bitmap.

Returns

An asynchronous operation that returns a SoftwareBitmap on successful completion.

Attributes
See Also

GetSoftwareBitmapAsync(BitmapPixelFormat, BitmapAlphaMode, BitmapTransform, ExifOrientationMode, ColorManagementMode) GetSoftwareBitmapAsync(BitmapPixelFormat, BitmapAlphaMode, BitmapTransform, ExifOrientationMode, ColorManagementMode) GetSoftwareBitmapAsync(BitmapPixelFormat, BitmapAlphaMode, BitmapTransform, ExifOrientationMode, ColorManagementMode)

Asynchronously gets a SoftwareBitmap representation of the bitmap frame.

public : IAsyncOperation<SoftwareBitmap> GetSoftwareBitmapAsync(BitmapPixelFormat pixelFormat, BitmapAlphaMode alphaMode, BitmapTransform transform, ExifOrientationMode exifOrientationMode, ColorManagementMode colorManagementMode)public IAsyncOperation<SoftwareBitmap> GetSoftwareBitmapAsync(BitmapPixelFormat pixelFormat, BitmapAlphaMode alphaMode, BitmapTransform transform, ExifOrientationMode exifOrientationMode, ColorManagementMode colorManagementMode)Public Function GetSoftwareBitmapAsync(pixelFormat As BitmapPixelFormat, alphaMode As BitmapAlphaMode, transform As BitmapTransform, exifOrientationMode As ExifOrientationMode, colorManagementMode As ColorManagementMode) As IAsyncOperation( Of SoftwareBitmap )
Parameters
pixelFormat
BitmapPixelFormat BitmapPixelFormat BitmapPixelFormat

The pixel format of the software bitmap.

alphaMode
BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode

The alpha mode of the software bitmap.

transform
BitmapTransform BitmapTransform BitmapTransform

The transform of the software bitmap.

exifOrientationMode
ExifOrientationMode ExifOrientationMode ExifOrientationMode

The EXIF orientation mode of the software bitmap.

colorManagementMode
ColorManagementMode ColorManagementMode ColorManagementMode

The color management mode of the software bitmap.

Returns

An asynchronous operation that returns a SoftwareBitmap on successful completion.

Attributes
See Also

GetThumbnailAsync() GetThumbnailAsync() GetThumbnailAsync()

Asynchronously returns a stream containing the thumbnail image.

public : IAsyncOperation<ImageStream> GetThumbnailAsync()public IAsyncOperation<ImageStream> GetThumbnailAsync()Public Function GetThumbnailAsync() As IAsyncOperation( Of ImageStream )
Returns

Object that manages the asynchronous retrieval of the thumbnail data.

Attributes

Remarks

Many image formats, like JPEG and TIFF, allow a small sized thumbnail of the full image to be embedded within a frame. If the image does not contain a thumbnail, then this operation will fail with HRESULT WINCODEC_ERR_CODECNOTHUMBNAIL. If it exists, the EXIF orientation flag on the frame is automatically applied to the thumbnail before it is returned.