2003.08.07 06:36 "[Tiff] Custom tags", by Ashley Dreier
Hi again.
Further to my previous email, I find that things work okay for TIFF_ASCII tags (as in I can read/modify/write them). Still having the same problem for other custom tags though which are either TIFF_SHORT or TIFF_LONG. Looks like it's perhaps a pointer addressing/casting problem somewhere.
The TIFFFieldInfo contains something like the following:
static const TIFFFieldInfo myFieldInfo[] = {
{ TIFFTAG_NAME, 4, 4, TIFF_ASCII, FIELD_CUSTOM, FALSE, FALSE, "Name" },
{ TIFFTAG_SEQUENCENUMBER,1, 1, TIFF_LONG, FIELD_CUSTOM, FALSE, TRUE, "SequenceNumber" }
};
To read them, I use:
void *data;
short count;
if (!TIFFGetField(tif, TIFFTAG_NAME, &data))
printf("Unable to get TIFFTAG_NAME\n");
else
printf("NAME = %s\n", (char *) data;
if (!TIFFGetField(tif, TIFFTAG_SEQUENCENUMBER, &count, &data))
warning(": Unable to get TIFFTAG_SEQUENCENUMBER\n");
else
{
printf("SEQUENCENUMBER = ");
for (i = 0; i < count; i++)
printf("%d ", ((long *) data)[0]);
printf("\n");
}
Once I specify the FieldInfo structure for the TIFF_LONG tag, then calling TIFFRewriteDirectory() causes a segfault, even without trying to read/modify any of the custom tags. Hence it sounds like an internal TIFF library error.
Regards,
Ash.
Ashley J. Dreier. Email: Ashley.Dreier@csiro.au
CSIRO Manufacturing and Infrastructure Tech, Phone: +61 3 9662 7799
Locked Bag No. 9, Fax: +61 3 9662 7851
Preston, Vic, 3072, Australia.
URL: http://www.msa.cmst.csiro.au/cmst/automation/staff/ajd