Zero scanline size is definitely not supported by libtiff/LibTiff.Net. I do not know about any other viewer that supports images with scanlines of zero length.
Jim sent us couple of such files and it turned out that the files are corrupt/broken. They specify zero width for their first page.
I tried to open these files in some other image viewers and only Preview utility in Mac OS X Mavericks could open them. The utility opens both files but silently skips the fist broken page. It shows not errors and acts like there is one less page in the files.
To achieve the same (silently skip first page), you can use the following workaround:
- Open the TIFF in append mode
- Set current page to be first page
- In a loop check the size of each page
- Skip any page with zero width or height
Below is a sample code for the workaround.
// "a" is for append
using (Tiff inImage = Tiff.Open(put-file-name-here, "a"))
{
if (inImage == null)
return;
// move to the first page
inImage.SetDirectory(0);
do
{
FieldValue[] width = inImage.GetField(TiffTag.IMAGEWIDTH);
FieldValue[] height = inImage.GetField(TiffTag.IMAGEWIDTH);
if (width[0].ToInt() != 0 && height[0].ToInt() != 0)
{
// the page appears correct, do something with it
}
} while (inImage.ReadDirectory());
}