AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2003.12.26 18:02 "[Tiff] Error with sample code to copy a custom tag", by Carl J. Collin
2003.12.26 18:32 "Re: [Tiff] Error with sample code to copy a custom tag", by Andrey Kiselev
2004.02.03 17:42 "[Tiff] Re: Recent Post you made about Custom Tags", by Frank Warmerdam

2004.02.03 17:42 "[Tiff] Re: Recent Post you made about Custom Tags", by Frank Warmerdam

Bill Cassanova wrote:

> I thought I remembered seeing a message from the libtiff users group about > Custom tags now being

> fully supported in a newer version of libtiff. Was I correct or was the post in > reference to something

> else possibly non-related.

Bill,

Yes, as of libtiff 3.6.1 otherwise unrecognised tags (not quite properly called custom tags) are supported for pretty much normal access. You can use TIFFGetField() to fetch the values.

There are some caveats:

/* Tiff info structure.

  *
  *     Entry format:
  *        { TAGNUMBER, ReadCount, WriteCount, DataType, FIELDNUM,
  *          OkToChange, PassDirCountOnSet, AsciiName }
  *
  *     For ReadCount, WriteCount, -1 = unknown.
  */

     static const TIFFFieldInfo xtiffFieldInfo[] = {

   /* XXX Insert Your tags here */

     { TIFFTAG_GEOPIXELSCALE,   -1,-1, TIFF_DOUBLE,     FIELD_CUSTOM,

       TRUE,    TRUE,   "GeoPixelScale" },
     { TIFFTAG_INTERGRAPH_MATRIX,-1,-1, TIFF_DOUBLE,    FIELD_CUSTOM,
       TRUE,    TRUE,   "Intergraph TransformationMatrix" },
     { TIFFTAG_GEOTRANSMATRIX,  -1,-1, TIFF_DOUBLE,     FIELD_CUSTOM,
       TRUE,    TRUE,   "GeoTransformationMatrix" },
     { TIFFTAG_GEOTIEPOINTS,    -1,-1, TIFF_DOUBLE,     FIELD_CUSTOM,
       TRUE,    TRUE,   "GeoTiePoints" },
     { TIFFTAG_GEOKEYDIRECTORY,-1,-1, TIFF_SHORT,       FIELD_CUSTOM,
       TRUE,    TRUE,   "GeoKeyDirectory" },
     { TIFFTAG_GEODOUBLEPARAMS, -1,-1, TIFF_DOUBLE,     FIELD_CUSTOM,
       TRUE,    TRUE,   "GeoDoubleParams" },
     { TIFFTAG_GEOASCIIPARAMS,  -1,-1, TIFF_ASCII,      FIELD_CUSTOM,
       TRUE,    FALSE,  "GeoASCIIParams" },

#ifdef JPL_TAG_SUPPORT

     { TIFFTAG_JPL_CARTO_IFD,    1, 1, TIFF_LONG,       FIELD_CUSTOM,

       TRUE,    TRUE,   "JPL Carto IFD offset" },  /** Don't use this! **/

#endif
};

#define N(a) (sizeof (a) / sizeof (a[0]))
static void _XTIFFLocalDefaultDirectory(TIFF *tif)
{
     /* Install the extended Tag field info */
     TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));
}

I have taken the liberty of cc:ing this to the tiff mailing list since this sort of question comes up fairly often. Clearly we need an FAQ or some better online documentation on the whole area of custom tags.

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