Cannot decode the image with very large resolutions using Windows Imaging Component (WIC)

zhulj 6 Reputation points
2020-08-18T05:48:14.167+00:00

Hi,

Would you please tell me whether there is a limit to the images processed by Windows Imaging Component (WIC) and the maximum resolution of images that can be processed.

Image data to be processed:
Picture specifications
Byte size: 133M
Format: BMP
Resolution: 600DPI
Height: 56173
Width: 19866
Bit depth: 1

Code:

 CoInitialize(NULL);
 IWICImagingFactory* pFactory = NULL;
 IWICBitmapClipper* pIClipper = NULL;
 IWICBitmapDecoder *pIDecoder = NULL;
 IWICBitmapFrameDecode *pIDecoderFrame = NULL;
 IWICBitmapFrameEncode *piFrameEncode = NULL;
 IWICStream *piFileStream = NULL;
 IWICBitmapEncoder *piEncoder = NULL;
 WICPixelFormatGUID pixelFormat = { 0 };


 HRESULT hr = CoCreateInstance(
 CLSID_WICImagingFactory,
 NULL,
 CLSCTX_INPROC_SERVER,
 IID_PPV_ARGS(&pFactory)
 );
 if (FAILED(hr))
 {
 goto CLEAN;
 }
   //Error is caused at below line
 hr = pFactory->CreateDecoderFromFilename(
 originalPath,
 NULL,
 GENERIC_READ,
 WICDecodeMetadataCacheOnDemand,
 &pIDecoder
 );

Error Msg shown is:
Message :WINCODEC_ERR_UNKNOWNIMAGEFORMAT(0x88982f07)

Thanks in advance!!!


-zhulj

Windows development | Windows API - Win32
{count} votes

1 answer

Sort by: Most helpful
  1. Rita Han - MSFT 2,171 Reputation points
    2020-08-18T08:59:30.897+00:00

    Hello,

    There seems a limitation that when the dimensions of a bitmap image larger that 27000 * 19883 (or 56173 * 9556), it will not be displayed successfully (via File Explorer preview or Photos etc.) Meanwhile, CreateDecoderFromFilename results in error WINCODEC_ERR_UNKNOWNIMAGEFORMAT(0x88982f07).

    Error message displayed in Photos like this:

    18273-20200818-2.png

    So please check if the image can be displayed on Windows.

    Thank you!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.