Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

MFCalculateBitmapImageSize function

Retrieves the image size for a video format. Given a BITMAPINFOHEADER structure, this function calculates the correct value of the biSizeImage member.


HRESULT MFCalculateBitmapImageSize(
  _In_   UINT32 cbBufSize,
  _Out_  UINT32 *pcbImageSize,
  _Out_  BOOL *pbKnown


pBMIH [in]

Pointer to a BITMAPINFOHEADER structure that describes the format.

cbBufSize [in]

Size of the pBMIH buffer, in bytes. The size includes any color masks or palette entries that follow the BITMAPINFOHEADER structure.

pcbImageSize [out]

Receives the image size, in bytes.

pbKnown [out]

Receives the value TRUE if the function recognizes the video format. Otherwise, receives the value FALSE. This parameter can be NULL.

Return value

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return codeDescription

The function succeeded.


The BITMAPINFOHEADER structure is not valid, or the value of cbBufSize is too small.



Before calling this function, you must set at least the following members of the BITMAPINFOHEADER structure:

  • biCompression
  • biBitCount
  • biWidth
  • biHeight

Also, if biCompression is BI_BITFIELDS, the BITMAPINFOHEADER structure must be followed by an array of color masks.

This function fails if the BITMAPINFOHEADER structure describes a format that is not a video format. For example, it fails if biCompresson is BI_JPEG or BI_PNG .

This function is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:

  • Windows XP with Service Pack 2 (SP2) and later.
  • Windows XP Media Center Edition 2005 with KB900325 (Windows XP Media Center Edition 2005) and KB925766 (October 2006 Update Rollup for Windows XP Media Center Edition) installed.


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]







See also

Media Foundation Functions



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.