Return-Path: <tiff-bounces@remotesensing.org>
Received: from inmx019.isp.belgacom.be (inmx019.isp.belgacom.be [195.238.3.138])
        by mailst035.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id j23JSij6011122
        for <joris.at.lebbeke@skynet.be>; Thu, 3 Mar 2005 20:28:47 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx019.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j23JS76a026692
        for <joris.at.lebbeke@skynet.be>; Thu, 3 Mar 2005 20:28:13 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id 1B043FBDA07; Thu,  3 Mar 2005 14:27:23 -0500 (EST)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205])
	by xserve.flids.com (Postfix) with ESMTP id 5B59BFBD9D9
	for <tiff@remotesensing.org>; Thu,  3 Mar 2005 14:27:20 -0500 (EST)
Received: by wproxy.gmail.com with SMTP id 69so570336wra
	for <tiff@remotesensing.org>; Thu, 03 Mar 2005 11:27:20 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com;
	h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references;
	b=kuHbKRBJ8Bf+jxCgdtK1CSR08MD4XRxN6Jj5xapKqMU7DjnCgwAdIjuttoQ/3S7xKiLB1DZST6tfUAJazI8OwdSSLmHcb0L/4QgJ36mwQWriOaZQvzhowtJW2bqN9nG2qgmam5NezgzKbY/aGRLgKcLP+Zk9bgILXm0HkfuM0NE=
Received: by 10.54.71.11 with SMTP id t11mr21498wra;
	Thu, 03 Mar 2005 11:27:19 -0800 (PST)
Received: by 10.54.13.2 with HTTP; Thu, 3 Mar 2005 11:27:18 -0800 (PST)
Message-ID: <931f8ea905030311273eeaf85b@mail.gmail.com>
Date: Thu, 3 Mar 2005 14:27:18 -0500
From: Frank Warmerdam <fwarmerdam@gmail.com>
To: Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
Subject: Re: [Tiff] LibTIFF question
In-Reply-To: <Pine.SOC.4.60.0503031318380.8945@blade.simplesystems.org>
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1523_17157778.1109878038233"
References: <4227471D.6020509@zenonbio.hu>
	<931f8ea9050303094829fd9755@mail.gmail.com>
	<Pine.SOC.4.60.0503031204150.8945@blade.simplesystems.org>
	<42275360.1000307@zenonbio.hu>
	<931f8ea90503031028217a0464@mail.gmail.com>
	<42275A1F.6090309@zenonbio.hu>
	<931f8ea9050303111667bb64b1@mail.gmail.com>
	<Pine.SOC.4.60.0503031318380.8945@blade.simplesystems.org>
Cc: libtiff-Mailinglist <tiff@remotesensing.org>
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: warmerdam@pobox.com
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: 5e9594aa1930ca2364f339a6457eb09b

------=_Part_1523_17157778.1109878038233
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Thu, 3 Mar 2005 13:19:50 -0600 (CST), Bob Friesenhahn
<bfriesen@simple.dallas.tx.us> wrote:
> Is there any way to quench the "unknown tag" errors if the application
> plans to handle them?  It would be nice if there was a way for the
> application to tell libtiff in advance that it is going to handle
> certain tags.

Bob,

Certainly.  Predefine the tags with TIFFMergeFieldInfo.
The tricky part is that each TIFF file instance carries
a list of tag definitions and you need to pre-define them
as part of the open process before tags start to get processed.

This works by installing a tag extender that will be invoked
for each TIFF file opened.   The GeoTIFF library does this
with the bulk of the code of interest being found in 
libgeotiff/xtiff.c which I am appending for people to review. 

I wrote up some of this in the Libtiff docs at:

  http://www.remotesensing.org/libtiff/addingtags.html

This is a subtopic of the "Modifying the TIFF Library"
page on the web site. 

I would agree that the TIFFGetField() man page needs to
be updated to reflect how it behaves for tags that have 
not been predefined. 

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

------=_Part_1523_17157778.1109878038233
Content-Type: application/octet-stream; name="xtiff.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="xtiff.c"

LyoKICogeHRpZmYuYwogKgogKiBFeHRlbmRlZCBUSUZGIERpcmVjdG9yeSBHRU8gVGFnIFN1cHBv
cnQuCiAqCiAqICBZb3UgbWF5IHVzZSB0aGlzIGZpbGUgYXMgYSB0ZW1wbGF0ZSB0byBhZGQgeW91
ciBvd24KICogIGV4dGVuZGVkIHRhZ3MgdG8gdGhlIGxpYnJhcnkuIE9ubHkgdGhlIHBhcnRzIG9m
IHRoZSBjb2RlCiAqICBtYXJrZWQgd2l0aCAiWFhYIiByZXF1aXJlIG1vZGlmaWNhdGlvbi4KICoK
ICogIEF1dGhvcjogTmlsZXMgRC4gUml0dGVyCiAqCiAqICBSZXZpc2lvbnM6CiAqICAgIDE4IFNl
cCAxOTk1ICAgLS0gRGVwcmVjYXRlZCBJbnRlZ3JhcGggTWF0cml4IHRhZyB3aXRoIG5ldyBvbmUu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V0dXJuZWQgYnkgWFRJRkZPcGVuKCku
CiAqIAogKiBJZiBhIEdUSUYgc3RydWN0dXJlIHdhcyBjcmVhdGVkIHdpdGggR1RJRk5ldygpCiAq
IGZvciB0aGlzIGZpbGUsIGl0IHNob3VsZCBiZSBmcmVlZCB3aXRoIEdUSUZGcmVlKCkKICogPGk+
YmVmb3JlPC9pPiBjYWxsaW5nIFhUSUZGQ2xvc2UoKS4KKi8KCnZvaWQKWFRJRkZDbG9zZShUSUZG
ICp0aWYpCnsKICAgIFRJRkZDbG9zZSh0aWYpOwp9Cg==
------=_Part_1523_17157778.1109878038233
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Tiff mailing list
Tiff@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff

------=_Part_1523_17157778.1109878038233--
