PixelDataProvider PixelDataProvider PixelDataProvider PixelDataProvider Class


Provides access to the pixel data from a bitmap frame.

public : sealed class PixelDataProvider : IPixelDataProviderpublic sealed class PixelDataProvider : IPixelDataProviderPublic NotInheritable Class PixelDataProvider Implements IPixelDataProvider// You can use this class in JavaScript.
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


An application asynchronously receives a PixelDataProvider from the GetPixelDataAsync methods of BitmapFrame or BitmapDecoder. The application can then synchronously request the pixel data using DetachPixelData to get access to the raw pixels of the bitmap.


DetachPixelData() DetachPixelData() DetachPixelData() DetachPixelData()

Returns the internally-stored pixel data.

public : byte[] DetachPixelData()public byte[] DetachPixelData()Public Function DetachPixelData() As byte[]// You can use this method in JavaScript.
byte[] byte[] byte[] byte[]

The pixel data.


PixelDataProvider doesn't retain a copy of the pixel data after a successful call to this method. This means that subsequent calls to the method will fail.

The return value is an array of 8 bit unsigned values. However, depending on the requested pixel format, the pixel data may represent another type. For example, if the pixel format is Rgba16, then each color value is a 16 bit unsigned integer that takes up two 8 bit elements of the array. You must convert the array to the correct type before you use it.