2002.01.02 18:00 "TIFF file with 2k header", by Eric Hamrick

2002.01.03 14:55 "RE: TIFF file with 2k header", by Kjetil Haga


It should be possible to use TIFFClientOpen() to achive this. This way there should be no need to modify libtiff. Below is an extract from an earlier post to this maling list:

Example reading from memory:

typedef struct {
        char *data;
        size_t data_size;
        size_t io_pos;
    } Fm_TiffInfo;

static tsize_t FM_tiffReadProc(thandle_t th, tdata_t buf, tsize_t
    Fm_TiffInfo *fmti = (Fm_TiffInfo *)th;

    if (fmti->io_pos + size > fmti->data_size)
        size = fmti->data_size - fmti->io_pos;

    (void)memcpy(buf, fmti->data + fmti->io_pos, size);
    fmti->io_pos += size;
    return size;


    Fm_TiffInfo fmti;

    fmti.data = data;
    fmti.data_size = data_size;
    fmti.io_pos = 0;


    tif = TIFFClientOpen("dummy", "r", (thandle_t) &fmti,
                         FM_tiffReadProc, FM_tiffWriteProc,
                         FM_tiffSeekProc, FM_tiffCloseProc,
                         FM_tiffSizeProc, FM_tiffMapProc,

This example is for reading a tiff file from a memory block. But it should be an easy task to modify the Fm_TiffInfo struct and FM_tiffReadProc to read directly from disk. You also have to write the other functions like FM_tiffSeekProc..

Good luck!


Kjetil Haga