2007.02.05 19:34 "[Tiff] The fake input in fax2tiff", by John Whitington

2007.02.06 10:54 "Re: [Tiff] The fake input in fax2tiff", by John Whitington


Quoting Joris <joris.at.lebbeke@skynet.be>:

I'm modifying the fax2tiff source to decode CCITT streams from PDF files into
raw data. Thus, I don't need to produce an output TIFF. It works, but now I'm
paring it down by removing the output code.

The fake input fax2tiff produces to make the fax input work is initialised in
the original source like this:

faxTIFF = TIFFClientOpen("(FakeInput)", "w",

/* TIFFClientOpen() fails if we don't set existing value here */ TIFFClientdata(out), TIFFGetReadProc(out), TIFFGetWriteProc(out), TIFFGetSeekProc(out), TIFFGetCloseProc(out), TIFFGetSizeProc(out), TIFFGetMapFileProc(out), TIFFGetUnmapFileProc(out));

(Where 'out' is the TIFF pointer being used for output).

How can I synthesize the values (TIFFClientdata etc.) without having to open an
actual output TIFF?

Perhaps I'm misunderstanding, but it seems to me there is a much easier approach. Work out a fake file header and fake IFD that for convinience you place right after the file header. Make the fake IFD have all appropriate settings for this kind of file, like appropriate Photometric and Compression

[snip details]

Or am I missing something?

fax2tiff works below the normal API level for libtiff, as far as I can see (which is why it directly references tiffiop.h and tif_config.h). The paramaters being generated in the original fax2tiff code I quote above are completely wrong, they're just non-NULL, to avoid the call to TiffClientOpen failing, The parameters themselves will never be called.

So I suppose I can rephrase: What's the easiest way to make non-NULL parameters of suitable types?

As you can guess, I'm not a C programmer! (I'm interfacing this code to another language)

John Whitington