Read tiff image file format by IImageReadFormat was not supported.
I use IImageReadFormat to read width and height from file.
This my source code:
InterfacePtr<IPMStream> fileStream(StreamUtil::CreateFileStreamRead(this->fSysFile));
if (fileStream == nil)
{
break;
}
InterfacePtr<IImageFormatManager> iImageFormatManager(::CreateObject2<IImageFormatManager>(kImageFormatManager, IID_IIMAGEFORMATMANAGER));
if (iImageFormatManager == nil)
break;
InterfacePtr<IImageReadFormat> iImageReadFormat(iImageFormatManager->QueryImageReadFormat(fileStream));
if (iImageReadFormat == nil)
break;
InterfacePtr<IImageAttributes> iImageAttr(::CreateObject2<IImageAttributes>(kImageObject, IID_IIMAGEATTRIBUTES));
if (iImageAttr == nil)
break;
if (iImageReadFormat->CanRead(fileStream) == kFalse)
break;
status = kTrue;
iImageReadFormat->Open(fileStream);
if (iImageReadFormat->GetImageAttributes(iImageAttr))
{
// Get width and height
}
.....
with tiff image iImageReadFormat->GetImageAttributes(iImageAttr) return kFalse with warning message: "Error encountered while reading TIFF image. Image may be damaged or incompatible. Resave the image with different setting and try again".
Anyone has other way to get tiff image width and height from file? Many thanks.