ITranscodeImage::TranscodeImage method (imagetranscode.h)

Converts an image to JPEG or bitmap (BMP) image format.

Syntax

HRESULT TranscodeImage(
  [in]            IShellItem *pShellItem,
                  UINT       uiMaxWidth,
                  UINT       uiMaxHeight,
                  DWORD      flags,
                  IStream    *pvImage,
  [out, optional] UINT       *puiWidth,
  [out, optional] UINT       *puiHeight
);

Parameters

[in] pShellItem

Type: IShellItem*

The Shell Item for the image to convert.

uiMaxWidth

Type: UINT

The requested height in pixels. Should be less than or equal to the actual height of the original image. See Remarks.

uiMaxHeight

Type: UINT

The requested width in pixels. Should be less than or equal to the actual width of the original image. See Remarks.

flags

Type: TI_FLAGS

One of the following flags.

TI_BITMAP

Convert the image to BMP format.

TI_JPEG

Convert the image to JPEG format.

pvImage

Type: IStream*

A stream to receive the converted image. The stream must be created by the calling code prior to calling TranscodeImage.

[out, optional] puiWidth

Type: UINT*

The actual width of the converted image.

[out, optional] puiHeight

Type: UINT*

The actual height of the converted image.

Return value

Type: HRESULT

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

Remarks

The aspect ratio of the original image is preserved. The new image is resized so that it will fit into a box of width uiMaxWidth and height uiMaxHeight.

The image size will not be changed if the original image already fits in this bounding box.

If both uiMaxWidth and uiMaxHeight are zero, the returned image will be the same size as the original.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header imagetranscode.h