IWICBitmapEncoder::Commit method (wincodec.h)

Commits all changes for the image and closes the stream.

Syntax

HRESULT Commit();

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

To finalize an image, both the frame Commit and the encoder Commit must be called. However, only call the encoder Commit method after all frames have been committed.

After the encoder has been committed, it can't be re-initialized or reused with another stream. A new encoder interface must be created, for example, with IWICImagingFactory::CreateEncoder.

For the encoder Commit to succeed, you must at a minimum call IWICBitmapEncoder::Initialize and either IWICBitmapFrameEncode::WriteSource or IWICBitmapFrameEncode::WritePixels.

IWICBitmapFrameEncode::WriteSource specifies all parameters needed to encode the image data. IWICBitmapFrameEncode::WritePixels requires that you also call IWICBitmapFrameEncode::SetSize, IWICBitmapFrameEncode::SetPixelFormat, and IWICBitmapFrameEncode::SetPalette (if the pixel format is indexed).

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

Commit

IWICBitmapEncoder