2003.11.17 16:07 "[Tiff] TIFF, v3.6.0. Fetching "custom" tags", by Frank Warmerdam
On Sun, Nov 16, 2003 at 07:45:43PM -0500, Chris Losinger wrote:
"Custom tags can be set and fetched normally using TIFFSetField() and
TIFFGetField(), and appear pretty much like normal tags to application code. "
I assume I can get rid of the tags/xtiff stuff and LibTiff will happily read and store any tags that it finds, even non-core tags, like 34665.
But, it doesn't seem to be working. When reading the TIFF dir, i get warnings about "unknown field with tag 34665 (0x8769) encountered", and when i call TIFFGetField, nothing is returned. It looks like v3.6.0. is behaving pretty much exactly like 3.5.7: complain about strange tags, then ignore them. But that's not what the documentation says is supposed to happen.
You should register all extended tags before you can work with them. See
a sample code attached.
The intent is that new tags encountered should auto-register themselves.
I checked with photometric.tif, and sure enough TIFFGetField() didn't work.
I looked into the code, and it seems that in tif_dirinfo.c 1.21 the line
dp->tdir_tag = IGNORE was added in causing the newly defined tag to be
ignored. This is something that I had removed in rev 1.17. Why was
it re-introduced. Even in 1.17 I wasn't clear on why the code had ever
been there, so perhaps there is a reason you added it?
With that line removed, the fetching of the new tag works fine. In fact
it is even reported by tiffinfo (named "Tag 34665"):
warmerda@gdal2200% tiffinfo photoshop.tif
TIFFReadDirectory: Warning, photoshop.tif: wrong data type 1 for "XMLPacket"; ta
TIFFReadDirectory: Warning, photoshop.tif: unknown field with tag 34665 (0x8769)
TIFF Directory at offset 0x8
Subfile Type: (0 = 0x0)
Image Width: 600 Image Length: 450
Resolution: 300, 300 pixels/inch
Compression Scheme: LZW
Photometric Interpretation: RGB color
Date & Time: "2003:07:24 11:31:44"
Image Description: " "
Planar Configuration: single image plane
Photoshop Data: <present>, 6162 bytes
RichTIFFIPTC Data: <present>, 6 bytes
Software: Adobe Photoshop 7.0
Tag 34665: 695892
Predictor: horizontal differencing 2 (0x2)
I haven't committed the change to tif_dirinfo.c yet, pending feedback on
why the IGNORE setting was there.
I set the clouds in motion - turn up | Frank Warmerdam, firstname.lastname@example.org
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent