Return-Path: <tiff-bounces@lists.maptools.org>
Received: from infbas004.isp.belgacom.be (localhost [127.0.0.1])
        by inav027.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AV-3.00) with ESMTP id j9VK5pT7000594
        for <joris.at.lebbeke@skynet.be>; Mon, 31 Oct 2005 21:05:52 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inas005.isp.belgacom.be (inas005.isp.belgacom.be [195.238.2.11])
        by infbas004.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j9VK4i47014211
        for <joris.at.lebbeke@skynet.be>; Mon, 31 Oct 2005 21:04:45 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx005.isp.belgacom.be (inmx005.isp.belgacom.be [195.238.5.148])
        by inas005.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AS-2.03) with ESMTP id j9VK4ZwY016092
        for <joris.at.lebbeke@skynet.be>; Mon, 31 Oct 2005 21:04:36 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx005.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j9VK4VfN018017
        for <joris.at.lebbeke@skynet.be>; Mon, 31 Oct 2005 21:04:32 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id j9VJrt5J011247;
	Mon, 31 Oct 2005 14:56:16 -0500
Received: from rrcs-mta-02.hrndva.rr.com (rrcs-mta-02.hrndva.rr.com
	[24.28.200.154])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id j9VJrq1j011192
	for <Tiff@lists.maptools.org>; Mon, 31 Oct 2005 14:53:53 -0500
Received: from rrcs-fep-11.hrndva.rr.com (rrcs-fep-11b.hrndva.rr.com
	[172.28.200.149])
	by rrcs-mta-02.hrndva.rr.com (8.13.1+Sun/8.12.10) with ESMTP id
	j9VJrGd2017525
	for <Tiff@lists.maptools.org>; Mon, 31 Oct 2005 14:53:36 -0500 (EST)
Received: from [192.168.1.216] (really [24.97.130.20])
	by rrcs-fep-11.hrndva.rr.com with ESMTP
	id <20051031195300.RYGD28210.rrcs-fep-11.hrndva.rr.com@[192.168.1.216]>
	for <Tiff@lists.maptools.org>; Mon, 31 Oct 2005 14:53:00 -0500
Message-ID: <43667615.10505@kitware.com>
Date: Mon, 31 Oct 2005 14:52:53 -0500
From: Mathieu Malaterre <mathieu.malaterre@kitware.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.7.8) Gecko/20050831 Debian/1.7.8-1sarge2
X-Accept-Language: en-us, fr
MIME-Version: 1.0
To: Tiff@lists.maptools.org
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Cc: 
Subject: [Tiff] TIFFSetField vs TIFFSetField+Private tags
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.00000dce
X-MSP-STORE: Mon, 31 Oct 2005 21:05:56 +0100
Status:   

Hello there,

	I am not sure I understand the private tags thing. What is wrong with 
the following code:

#define           TIFFTAG_PRIVATE         34595

static void TagExtender(TIFF *tiff)
{
   static const TIFFFieldInfo xtiffFieldInfo[] = {
       { TIFFTAG_PRIVATE, TIFF_VARIABLE, TIFF_VARIABLE, TIFF_BYTE,
       FIELD_CUSTOM, 0, 1, "Private Tag" }
   };

   TIFFMergeFieldInfo( tiff, xtiffFieldInfo,
     sizeof(xtiffFieldInfo) / sizeof(xtiffFieldInfo[0]) );
}

int main()
{
   TIFF *intif;
   int iCount;
   intif = TIFFOpen("bla.tif","w");
   TIFFSetTagExtender(TagExtender);

   TIFFSetDirectory(intif, 0);
   char *currentTag = 0;
   TIFFSetField(intif, TIFFTAG_SOFTWARE, "Foo Bar");
   TIFFGetField(intif, TIFFTAG_SOFTWARE, &currentTag);
   fprintf( stderr, "Soft tag : %s\n", currentTag );  // ok so far...

   iCount = sizeof(lng)/sizeof(lng[0]);
   TIFFSetField(intif, TIFFTAG_PRIVATE, iCount, lng); //-> returns 0

   TIFFWriteDirectory( intif );

   TIFFClose(intif);
   return 0;
}


Thanks
Mathieu
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
