BitmapFrame BitmapFrame BitmapFrame BitmapFrame Class

Provides read access to data within a single frame.

Syntax

Declaration

public sealed class BitmapFramepublic sealed class BitmapFramePublic NotInheritable Class BitmapFrame

Properties summary

The default alpha mode of the frame.

The pixel format that best fits the frame.

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

The horizontal resolution of the frame in dots per inch.

The vertical resolution of the frame in dots per inch.

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

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

The height of the frame in pixels.

The width of the frame in pixels.

Methods summary

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

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

Asynchronously gets a SoftwareBitmap representation of the bitmap frame.

Asynchronously gets a SoftwareBitmap representation of the bitmap frame.

Asynchronously gets a SoftwareBitmap representation of the bitmap frame.

Asynchronously returns a stream containing the thumbnail image.

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

    Property Value

    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

    Property Value

    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

    Property Value

  • 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

    Property 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

    Property 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 uint OrientedPixelHeight { get; }public uint OrientedPixelHeight { get; }Public ReadOnly Property OrientedPixelHeight As uint

    Property Value

    • uint
      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 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 uint OrientedPixelWidth { get; }public uint OrientedPixelWidth { get; }Public ReadOnly Property OrientedPixelWidth As uint

    Property Value

    • uint
      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 uint PixelHeight { get; }public uint PixelHeight { get; }Public ReadOnly Property PixelHeight As uint

    Property Value

    • uint
      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 uint PixelWidth { get; }public uint PixelWidth { get; }Public ReadOnly Property PixelWidth As uint

    Property Value

    • uint
      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 )

    Returns

    • Object that manages the asynchronous retrieval of the pixel data.

    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(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode,Windows.Graphics.Imaging.BitmapTransform,Windows.Graphics.Imaging.ExifOrientationMode,Windows.Graphics.Imaging.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.

  • GetPixelDataAsync(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode,Windows.Graphics.Imaging.BitmapTransform,Windows.Graphics.Imaging.ExifOrientationMode,Windows.Graphics.Imaging.ColorManagementMode)
    GetPixelDataAsync(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode,Windows.Graphics.Imaging.BitmapTransform,Windows.Graphics.Imaging.ExifOrientationMode,Windows.Graphics.Imaging.ColorManagementMode)
    GetPixelDataAsync(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode,Windows.Graphics.Imaging.BitmapTransform,Windows.Graphics.Imaging.ExifOrientationMode,Windows.Graphics.Imaging.ColorManagementMode)
    GetPixelDataAsync(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode,Windows.Graphics.Imaging.BitmapTransform,Windows.Graphics.Imaging.ExifOrientationMode,Windows.Graphics.Imaging.ColorManagementMode)

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

    public IAsyncOperation<PixelDataProvider> GetPixelDataAsync(Windows.Graphics.Imaging.BitmapPixelFormat pixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode alphaMode,Windows.Graphics.Imaging.BitmapTransform transform,Windows.Graphics.Imaging.ExifOrientationMode exifOrientationMode,Windows.Graphics.Imaging.ColorManagementMode colorManagementMode)public IAsyncOperation<PixelDataProvider> GetPixelDataAsync(Windows.Graphics.Imaging.BitmapPixelFormat pixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode alphaMode,Windows.Graphics.Imaging.BitmapTransform transform,Windows.Graphics.Imaging.ExifOrientationMode exifOrientationMode,Windows.Graphics.Imaging.ColorManagementMode colorManagementMode)Public Function GetPixelDataAsync(pixelFormat As Windows.Graphics.Imaging.BitmapPixelFormat,alphaMode As Windows.Graphics.Imaging.BitmapAlphaMode,transform As Windows.Graphics.Imaging.BitmapTransform,exifOrientationMode As Windows.Graphics.Imaging.ExifOrientationMode,colorManagementMode As Windows.Graphics.Imaging.ColorManagementMode) As IAsyncOperation( Of PixelDataProvider )

    Parameters

    Returns

    • Object that manages the asynchronous retrieval of the pixel data.

    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.

  • GetSoftwareBitmapAsync()
    GetSoftwareBitmapAsync()
    GetSoftwareBitmapAsync()
    GetSoftwareBitmapAsync()

    Asynchronously gets a SoftwareBitmap representation of the bitmap frame.

    public IAsyncOperation<SoftwareBitmap> GetSoftwareBitmapAsync()public IAsyncOperation<SoftwareBitmap> GetSoftwareBitmapAsync()Public Function GetSoftwareBitmapAsync() As IAsyncOperation( Of SoftwareBitmap )

    Returns

    • An asynchronous operation that returns a SoftwareBitmap on successful completion.

  • GetSoftwareBitmapAsync(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode)
    GetSoftwareBitmapAsync(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode)
    GetSoftwareBitmapAsync(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode)
    GetSoftwareBitmapAsync(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode)

    Asynchronously gets a SoftwareBitmap representation of the bitmap frame.

    public IAsyncOperation<SoftwareBitmap> GetSoftwareBitmapAsync(Windows.Graphics.Imaging.BitmapPixelFormat pixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode alphaMode)public IAsyncOperation<SoftwareBitmap> GetSoftwareBitmapAsync(Windows.Graphics.Imaging.BitmapPixelFormat pixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode alphaMode)Public Function GetSoftwareBitmapAsync(pixelFormat As Windows.Graphics.Imaging.BitmapPixelFormat,alphaMode As Windows.Graphics.Imaging.BitmapAlphaMode) As IAsyncOperation( Of SoftwareBitmap )

    Parameters

    Returns

    • An asynchronous operation that returns a SoftwareBitmap on successful completion.

  • GetSoftwareBitmapAsync(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode,Windows.Graphics.Imaging.BitmapTransform,Windows.Graphics.Imaging.ExifOrientationMode,Windows.Graphics.Imaging.ColorManagementMode)
    GetSoftwareBitmapAsync(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode,Windows.Graphics.Imaging.BitmapTransform,Windows.Graphics.Imaging.ExifOrientationMode,Windows.Graphics.Imaging.ColorManagementMode)
    GetSoftwareBitmapAsync(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode,Windows.Graphics.Imaging.BitmapTransform,Windows.Graphics.Imaging.ExifOrientationMode,Windows.Graphics.Imaging.ColorManagementMode)
    GetSoftwareBitmapAsync(Windows.Graphics.Imaging.BitmapPixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode,Windows.Graphics.Imaging.BitmapTransform,Windows.Graphics.Imaging.ExifOrientationMode,Windows.Graphics.Imaging.ColorManagementMode)

    Asynchronously gets a SoftwareBitmap representation of the bitmap frame.

    public IAsyncOperation<SoftwareBitmap> GetSoftwareBitmapAsync(Windows.Graphics.Imaging.BitmapPixelFormat pixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode alphaMode,Windows.Graphics.Imaging.BitmapTransform transform,Windows.Graphics.Imaging.ExifOrientationMode exifOrientationMode,Windows.Graphics.Imaging.ColorManagementMode colorManagementMode)public IAsyncOperation<SoftwareBitmap> GetSoftwareBitmapAsync(Windows.Graphics.Imaging.BitmapPixelFormat pixelFormat,Windows.Graphics.Imaging.BitmapAlphaMode alphaMode,Windows.Graphics.Imaging.BitmapTransform transform,Windows.Graphics.Imaging.ExifOrientationMode exifOrientationMode,Windows.Graphics.Imaging.ColorManagementMode colorManagementMode)Public Function GetSoftwareBitmapAsync(pixelFormat As Windows.Graphics.Imaging.BitmapPixelFormat,alphaMode As Windows.Graphics.Imaging.BitmapAlphaMode,transform As Windows.Graphics.Imaging.BitmapTransform,exifOrientationMode As Windows.Graphics.Imaging.ExifOrientationMode,colorManagementMode As Windows.Graphics.Imaging.ColorManagementMode) As IAsyncOperation( Of SoftwareBitmap )

    Parameters

    Returns

    • An asynchronous operation that returns a SoftwareBitmap on successful completion.

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

    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.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ContractVersionAttribute

Details

Assembly

Windows.Graphics.Imaging.dll