IWICBitmapSourceTransform::GetClosestSize method (wincodec.h)

Returns the closest dimensions the implementation can natively scale to given the desired dimensions.


HRESULT GetClosestSize(
  [in, out] UINT *puiWidth,
  [in, out] UINT *puiHeight


[in, out] puiWidth

Type: UINT*

The desired width. A pointer that receives the closest supported width.

[in, out] puiHeight

Type: UINT*

The desired height. A pointer that receives the closest supported height.

Return value


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


The Windows provided codecs provide the following support for native scaling:

  • BMP, ICO, GIF, TIFF: No implementation of IWICBitmapSourceTransform.
  • PNG: No scaling support.
  • JPEG: Native down-scaling by a factor of 8, 4, or 2.
  • JPEG-XR: Native scaling of the original image by powers of 2.


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