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 g16AbKt2003257
	for <dron@localhost>; Wed, 6 Feb 2002 13:39:45 +0300
Received: from eudoramail.com [209.185.123.45]
	by localhost with POP3 (fetchmail-5.9.0)
	for dron@localhost (single-drop); Wed, 06 Feb 2002 13:39:45 +0300 (MSK)
Received: from gate7.olympiakos.com ([207.176.88.85]) by shared1-mail.whowhere.com; Tue Feb  5 06:41:02 2002
Received: from localhost (daemon@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) with SMTP id JAA22291;
	Tue, 5 Feb 2002 09:22:19 -0500
Received: by gate7.olympiakos.com (bulk_mailer v1.9); Tue, 5 Feb 2002 09:20:57 -0500
Received: (from majordom@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) id JAA22248
	for tiff-outgoing; Tue, 5 Feb 2002 09:20:56 -0500
X-Authentication-Warning: gate7.olympiakos.com: majordom set sender to owner-tiff@olympiakos.com using -f
Received: from dms.corena.no (dms.corena.no [193.69.46.253])
	by gate7.olympiakos.com (8.9.3/8.9.3) with SMTP id JAA22245
	for <tiff@olympiakos.com>; Tue, 5 Feb 2002 09:20:54 -0500
Received: from bpb-laptop by dms.corena.no (AIX 3.2/UCB 5.64/4.03)
          id AA28092; Tue, 5 Feb 2002 15:22:48 +0100
Message-Id: <3C5FEA3C.7020008@corena.no>
Date: Tue, 05 Feb 2002 15:20:44 +0100
From: Bjorn Brox <brox@corena.no>
Organization: Privat
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.7+) Gecko/20020116
X-Accept-Language: en-us, no,da,sv,en
Mime-Version: 1.0
To: Jon Saxton <js@triton.vg>
Cc: tiff@olympiakos.com
Subject: Re: tiff (libtiff)
References: <20020203050022.86826.qmail@web20508.mail.yahoo.com> <003501c1acfb$eda273e0$0201a8c0@pacbell.net> <20020205123324.VMTG21100.out010.verizon.net@proteus>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Sender: owner-tiff@olympiakos.com
Precedence: bulk
Status: RO
Content-Length: 1668
Lines: 49

Jon Saxton wrote:
> ** Reply to message from Peter Montgomery <pjmonty@csi.com> on Sun, 03 Feb 2002
...
>>I'm not sure of the best way to directly handle an image in memory, but
>>perhaps letting the list know what platform you're working on may be of
>>benefit to finding a solution.
...
> Oh boy, I shall follow this discussion with interest.

There is absolutely no problems in using libtiff to read images stored 
in memory.
Just use the TIFFClientOpen() function to open the image.

     tif = TIFFClientOpen("dummy", "r", (thandle_t) &fmti,
                          FM_tiffReadProc, FM_tiffWriteProc,
                          FM_tiffSeekProc, FM_tiffCloseProc,
                          FM_tiffSizeProc, FM_tiffMapProc,
                          FM_tiffUnmapProc);
Where for example the fmti structure is:
typedef struct {
         const char *gfx_name;
         char *data;
         size_t data_size;
         size_t io_pos;
     } Fm_DiMemIo;
and for example FM_tiffReadProc() is like this:

static tsize_t FM_tiffReadProc(thandle_t th, tdata_t buf, tsize_t size)
{
     Fm_DiMemIo *fmti = (Fm_DiMemIo *)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);
}



-- 
Bjorn Brox, CORENA Norge AS, http://www.corena.no/, ICQ 17872043
Kirkegaardsvn. 45, P.O.Box 1024, N-3601 Kongsberg, NORWAY
Phone: +47 32287435, Fax: +47 32287430, Mobile: +47 92638590


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

