Return-Path: owner-tiff@olympiakos.com
Return-Path: <owner-tiff@olympiakos.com>
Received: from localhost (localhost [127.0.0.1])
	by at1895.spb.edu (8.12.1/8.12.1/Debian -1) with ESMTP id g03MTGrF009855
	for <dron@localhost>; Fri, 4 Jan 2002 01:34:16 +0300
Received: from eudoramail.com [209.185.123.45]
	by localhost with POP3 (fetchmail-5.9.0)
	for dron@localhost (single-drop); Fri, 04 Jan 2002 01:34:16 +0300 (MSK)
Received: from gate7.olympiakos.com ([207.176.88.85]) by shared1-mail.whowhere.com; Thu Jan  3 07:03:19 2002
Received: from localhost (daemon@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) with SMTP id JAA13958;
	Thu, 3 Jan 2002 09:54:55 -0500
Received: by gate7.olympiakos.com (bulk_mailer v1.9); Thu, 3 Jan 2002 09:53:35 -0500
Received: (from majordom@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) id JAA13909
	for tiff-outgoing; Thu, 3 Jan 2002 09:53:35 -0500
X-Authentication-Warning: gate7.olympiakos.com: majordom set sender to owner-tiff@olympiakos.com using -f
Received: from mailgw1.kongsberg.com (mailgw.kongsberg.com [193.71.180.98])
	by gate7.olympiakos.com (8.9.3/8.9.3) with ESMTP id JAA13906
	for <tiff@olympiakos.com>; Thu, 3 Jan 2002 09:53:32 -0500
From: kjetil.haga@kongsberg.com
Received: from kdaexc2.net2.kongsberg.com (unverified) by mailgw1.kongsberg.com
 (Content Technologies SMTPRS 4.2.5) with ESMTP id <T58397c4615c147b442053@mailgw1.kongsberg.com>;
 Thu, 3 Jan 2002 15:59:27 +0100
Received: by kdaexc2.net2.kongsberg.com with Internet Mail Service (5.5.2653.19)
	id <ZK6J8XYT>; Thu, 3 Jan 2002 15:52:59 +0100
Message-ID: <A009701C60309940BE9279004F498C0D23622F@kdaexc4.ks-t.no>
To: Kari.Poysa@usa.xerox.com, hamrick.6@osu.edu, tiff@olympiakos.com
Subject: RE: TIFF file with 2k header
Date: Thu, 3 Jan 2002 15:55:54 +0100 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: text/plain;
	charset="iso-8859-1"
Sender: owner-tiff@olympiakos.com
Precedence: bulk
Status: RO
Content-Length: 3586
Lines: 120

Hi,

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
size)
{
    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;

    (void)TIFFSetWarningHandler(FM_tiffWarningHandler);
    (void)TIFFSetErrorHandler(FM_tiffErrorHandler);

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




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!


Regards,

Kjetil Haga


-----Original Message-----
From: Poysa, Kari [mailto:Kari.Poysa@usa.xerox.com]
Sent: 3. januar 2002 15:25
To: 'Eric Hamrick'; tiff@olympiakos.com
Subject: RE: TIFF file with 2k header


Eric,
 
I would try modifying the operating system specific file that contains
the file open, close and especially seek functions.  In my case this
is the "tif_unix.c" file.  What you can do is (1) seek past the 2k
header right after opening the file, and (2) add the 2k for each
offset passed to the seek function.  This way, the rest of the library
is fooled into thinking that there is no header.  Remember to subtract
the 2k from the value that the seek function returns.
 
I have not implemented this, but it looks simple enough.  I have not
tinkered with reading TIFF files using the library, but I have made
some changes into the library code for writing new TIFF files. The
library uses these platform dependent functions for portability
reasons, and that should be a nice place for your changes.  The
resulting modified library of course is pretty application dependent.
If you try this, please let me know how it went.
 
    --- Kari Poysa ---
 
-----Original Message-----
From: Eric Hamrick [mailto:hamrick.6@osu.edu]
Sent: Wednesday, January 02, 2002 1:01 PM
To: tiff@olympiakos.com
Subject: TIFF file with 2k header


hi all
 
I have tiff files with a vendor specific 2 kilobyte header at
the beginning of the file. Currently I'm just rewriting the
file to a different location without the header and then
calling the libtiff functions on that file. Is there an easy
way to have libtiff load the image directly by ignoring the
the 2k header each time. I've tried to make some 
modifications at some points in the libtiff code to set the 
tiff file pointer but have only succeeded in making a 
mess. :) So if anyone knows of a strategic place to put code
keeping the tif file pointer always 2k past the beginning of
the file that would be great. Maybe I'm making this harder
than it actually is. 
 
Thanks!
Eric Hamrick
 
 
 

To subscribe or unsubscribe email tiff-request@olympiakos.com with subscribe
or unsubscribe in the email body.  Libtiff home page: http://www.libtiff.org

