BitmapFrame BitmapFrame BitmapFrame BitmapFrame Class

Definition

Provides read access to data within a single frame.

public : sealed class BitmapFrame : IBitmapFrame, IBitmapFrameWithSoftwareBitmap
public sealed class BitmapFrame : IBitmapFrame, IBitmapFrameWithSoftwareBitmap
Public NotInheritable Class BitmapFrame Implements IBitmapFrame, IBitmapFrameWithSoftwareBitmap
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Properties

BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode

The default alpha mode of the frame.

public : BitmapAlphaMode BitmapAlphaMode { get; }
public BitmapAlphaMode BitmapAlphaMode { get; }
Public ReadOnly Property BitmapAlphaMode As BitmapAlphaMode
var bitmapAlphaMode = bitmapFrame.bitmapAlphaMode;
Value
BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode

The default alpha mode of the frame.

Remarks

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

BitmapPixelFormat 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
var bitmapPixelFormat = bitmapFrame.bitmapPixelFormat;
Value
BitmapPixelFormat BitmapPixelFormat BitmapPixelFormat BitmapPixelFormat

The pixel format that best fits the first frame.

Remarks

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

BitmapProperties 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
var bitmapPropertiesView = bitmapFrame.bitmapProperties;
Value
BitmapPropertiesView BitmapPropertiesView BitmapPropertiesView BitmapPropertiesView

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

DpiX 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
var double = bitmapFrame.dpix;
Value
double double double double

The horizontal resolution of the frame in dots per inch.

DpiY 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
var double = bitmapFrame.dpiy;
Value
double double double double

The vertical resolution of the frame in dots per inch.

OrientedPixelHeight OrientedPixelHeight OrientedPixelHeight OrientedPixelHeight

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

public : unsigned int OrientedPixelHeight { get; }
public uint OrientedPixelHeight { get; }
Public ReadOnly Property OrientedPixelHeight As uint
var uint = bitmapFrame.orientedPixelHeight;
Value
unsigned int uint uint uint

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

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 OrientedPixelWidth

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

public : unsigned int OrientedPixelWidth { get; }
public uint OrientedPixelWidth { get; }
Public ReadOnly Property OrientedPixelWidth As uint
var uint = bitmapFrame.orientedPixelWidth;
Value
unsigned int uint uint uint

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

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 PixelHeight

The height of the frame in pixels.

public : unsigned int PixelHeight { get; }
public uint PixelHeight { get; }
Public ReadOnly Property PixelHeight As uint
var uint = bitmapFrame.pixelHeight;
Value
unsigned int uint uint uint

The height of the frame in pixels.

Remarks

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

PixelWidth PixelWidth PixelWidth PixelWidth

The width of the frame in pixels.

public : unsigned int PixelWidth { get; }
public uint PixelWidth { get; }
Public ReadOnly Property PixelWidth As uint
var uint = bitmapFrame.pixelWidth;
Value
unsigned int uint uint uint

The width of the frame in pixels.

Remarks

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

Methods

GetPixelDataAsync() 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 )
var iAsyncOperation = bitmapFrame.getPixelDataAsync();
Returns

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) 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 )
var iAsyncOperation = bitmapFrame.getPixelDataAsync(pixelFormat, alphaMode, transform, exifOrientationMode, colorManagementMode);
Parameters
alphaMode
BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode

The specified alpha mode.

transform
BitmapTransform BitmapTransform BitmapTransform BitmapTransform

The set of transformations to be applied to the frame.

exifOrientationMode
ExifOrientationMode ExifOrientationMode ExifOrientationMode ExifOrientationMode

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

colorManagementMode
ColorManagementMode ColorManagementMode ColorManagementMode ColorManagementMode

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

Returns

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

GetSoftwareBitmapAsync(BitmapPixelFormat, BitmapAlphaMode) 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 )
var iAsyncOperation = bitmapFrame.getSoftwareBitmapAsync(pixelFormat, alphaMode);
Parameters
pixelFormat
BitmapPixelFormat BitmapPixelFormat BitmapPixelFormat BitmapPixelFormat

The pixel format of the software bitmap.

alphaMode
BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode

The alpha mode of the software bitmap.

Returns
See Also

GetSoftwareBitmapAsync(BitmapPixelFormat, BitmapAlphaMode, BitmapTransform, ExifOrientationMode, ColorManagementMode) 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 )
var iAsyncOperation = bitmapFrame.getSoftwareBitmapAsync(pixelFormat, alphaMode, transform, exifOrientationMode, colorManagementMode);
Parameters
pixelFormat
BitmapPixelFormat BitmapPixelFormat BitmapPixelFormat BitmapPixelFormat

The pixel format of the software bitmap.

alphaMode
BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode BitmapAlphaMode

The alpha mode of the software bitmap.

transform
BitmapTransform BitmapTransform BitmapTransform BitmapTransform

The transform of the software bitmap.

exifOrientationMode
ExifOrientationMode ExifOrientationMode ExifOrientationMode ExifOrientationMode

The EXIF orientation mode of the software bitmap.

colorManagementMode
ColorManagementMode ColorManagementMode ColorManagementMode ColorManagementMode

The color management mode of the software bitmap.

Returns
See Also

GetThumbnailAsync() 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 )
var iAsyncOperation = bitmapFrame.getThumbnailAsync();
Returns

Object that manages the asynchronous retrieval of the thumbnail data.

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.