2005.08.09 13:56 "[Tiff] Binary Data in Artist Tag", by J winchester

2005.08.09 18:20 "Re: [Tiff] Binary Data in Artist Tag", by Andrey Kiselev

On Tue, Aug 09, 2005 at 01:56:31PM +0000, J winchester wrote:

I'm trying to use libtiff to read a tiff file that has some binary data stored in the Artist tag. The data was put there by another program that I have no control over. I can't read the data because libtiff is treating it as an ASCII tag. When I attempt to read the field, libtiff stops reading when it hits the first NULL byte in the data. I've tried using TIFFMergeFieldInfo to change the parameters for that tag but It didn't seem to work. I know this is a non-standard use for the tag but I was wondering if anybody knew how I might be able to read and write this data.


I am afraid there is no way to avoid that except modifying libtiff sources. Try to replace the Artist tag data type in the tif_dirinfo.c to TIFF_UNDEFINED. It will be read as array of bytes. You should also change the passcount field. So it will look like that:

          TRUE, TRUE, "Artist" },

an you will read the field in the following way:

uint16 count;
uint8 *buffer;

TIFFGetField(tiff, TIFFTAG_ARTIST, &count, &buffer);

In the 'count' variable you will get the buffer size.


Andrey V. Kiselev

Home phone: +7 812 5970603 ICQ# 26871517