IWICBitmapFrameEncode::SetPixelFormat method (wincodec.h)

Requests that the encoder use the specified pixel format.

Syntax

HRESULT SetPixelFormat(
  [in, out] WICPixelFormatGUID *pPixelFormat
);

Parameters

[in, out] pPixelFormat

Type: WICPixelFormatGUID*

On input, the requested pixel format GUID. On output, the closest pixel format GUID supported by the encoder; this may be different than the requested format. For a list of pixel format GUIDs, see Native Pixel Formats.

Return value

Type: HRESULT

Possible return values include the following.

Return code Description
S_OK
Success.
WINCODEC_ERR_WRONGSTATE
The IWICBitmapFrameEncode::Initialize method was not called.

Remarks

The encoder might not support the requested pixel format. If not, SetPixelFormat returns the closest match in the memory block that pPixelFormat points to. If the returned pixel format doesn't match the requested format, you must use an IWICFormatConverter object to convert the pixel data.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header wincodec.h
Library Windowscodecs.lib
DLL Windowscodecs.dll

See also

IWICBitmapFrameEncode

Native Pixel Formats