[OSGeo-Discuss] any library for modifying TIFF tags ?
Frank Warmerdam
warmerdam at pobox.com
Sat Jun 20 05:16:43 PDT 2009
Jachym Cepicky wrote:
> Hi,
>
> I try o add custom (proprietary) tags to TIFF files. I tried to modify
> libtiff [1] according to [2], I added lines
>
> libtiff/tiff.h:
> #define TIFFTAG_SIGNATURE 65001
>
> libtiff/tif_dirinfo.c (line 392):
> { TIFFTAG_SIGNATURE, TIFF_VARIABLE, TIFF_VARIABLE,
> TIFF_UNDEFINED, FIELD_CUSTOM, 1, 0, "Signature" },
>
> The tag should be TIFF_UNDEFINED according to documentation. I'm able to
> read the tag value, but never able to set the tag value, no matter, if
> the tag is already available in the image or not (fresh image).
>
> I wanted to ask, if there is someone out there, who successfully uses
> libtiff or similar/other library/program, for editing of tiff
> (preferably UNDEFINED) tags. Any experience with Python-Image?
Jachym,
I am familiar with extending libtiff with custom tags. Note there are
less intrusive ways of registering custom tags that do not require modifying
libtiff itself. For instance, GDAL does this to add some custom tags:
static TIFFExtendProc _ParentExtender = NULL;
static void GTiffTagExtender(TIFF *tif)
{
static const TIFFFieldInfo xtiffFieldInfo[] = {
{ TIFFTAG_GDAL_METADATA, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
TRUE, FALSE, (char*) "GDALMetadata" },
{ TIFFTAG_GDAL_NODATA, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
TRUE, FALSE, (char*) "GDALNoDataValue" },
{ TIFFTAG_RPCCOEFFICIENT, -1,-1, TIFF_DOUBLE, FIELD_CUSTOM,
TRUE, TRUE, (char*) "RPCCoefficient" }
};
if (_ParentExtender)
(*_ParentExtender)(tif);
TIFFMergeFieldInfo( tif, xtiffFieldInfo,
sizeof(xtiffFieldInfo) / sizeof(xtiffFieldInfo[0]) );
}
I'm not clear on why you are unable to set a tag of type UNDEFINED though
I rarely work with this type. I would suggest you prepare a minimal program
using libtiff to demonstrate this issue and post about the issue on the
libtiff mailing list. Then I, or someone else, may be able to provide more
detailed advice.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Discuss
mailing list