2014.05.08 23:14 "[Tiff] what's up with all the seeking?", by Jeff Breidenbach

2014.05.09 02:53 "Re: [Tiff] what's up with all the seeking?", by Steve Underwood

Hi Jeff,

Yes, TIFF is fundamentally incompatible with streaming. There are some TIFF related specs, such as the earliest RFCs on TIFF for internet FAX, which try to impose rules which would allow TIFF to be effectively streamed. In practice those specs failed.

The main issue is you can only interpret the contents of the file by following the directories, and the directories can be anywhere. In most TIFF files you will find the directory for a page right after the image data for that page. This makes sense from a sequential file generation point of view, as typically you don't fully know what the directory should contain until you have generated the entire image. It does, however, mean that on reading the TIFF file you need to seek beyond the image to get to the directory which tells you the extent of the image data, and how to interpret its contents.

Regards,
Steve

On 05/09/2014 07:14 AM, Jeff Breidenbach wrote:

Is TIFF fundamentally incompatible with streaming?

===

#include <tiffio.h>
#include <stdio.h>

main() {
  TIFF *tiff = TIFFFdOpen(fileno(stdin), "stdin", "rb");
  TIFFClose(tiff);
}

===

$ gcc -o mypgram mypgram.c -ltiff
$ pbmmake 1000 1000 | pnmtotiff -g4 > foo tif
$ myprogram < foo.tif

TIFFFetchDirectory: stdin: Seek error accessing TIFF directory. TIFFReadDirectory: Failed to read directory at offset 40. Segmentation fault (core dumped)