Resize an image or set of images.

Note: that if given a set of images, the resulting ScratchImage will always have mipLevels of 1 (i.e. any mipmaps from the original are discarded)

HRESULT Resize( _In_ const Image& srcImage,
    _In_ size_t width, _In_ size_t height, _In_ DWORD filter,
    _Out_ ScratchImage& image );

HRESULT Resize( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages,
    _In_ const TexMetadata& metadata,
    _In_ size_t width, _In_ size_t height, _In_ DWORD filter,
    _Out_ ScratchImage& result );

Parameters

filter: See Filter Flags

If using TEX_FILTER_DEFAULT, this routine will default to using FANT if using the WIC code paths. If using the non-WIC codepaths, it defaults to BOX if the destination image is half the size in both dimensions of the source image, otherwise it defaults to LINEAR.

Example

ScratchImage srcImage;

...

ScratchImage destImage;
hr = Resize( srcImage.GetImages(), srcImage.GetImageCount(), srcImage.GetMetadata(),
   100, 50, TEX_FILTER_DEFAULT, destImage );
if ( FAILED(hr) )
    ...

Remarks

This function does not operate directly on block compressed images. See Decompress and Compress.

This function cannot operate directly on a planar format image. See ConvertToSinglePlane for a method for converting planar data to a format that is supported by this routine.

The second version of Resize is intended for working with 1D arrays, 2D arrays, cubemaps, and cubemap arrays with mipmaps.

This function is implemented with both WIC and non-WIC code paths. The WIC code paths are used for > 8-bit color depth formats, sRGB color formats, or when WRAP/MIRROR semantics are requested.

Release Notes