AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2005.03.03 17:19 "[Tiff] LibTIFF question", by Kalman Miklos
2005.03.03 17:48 "Re: [Tiff] LibTIFF question", by Frank Warmerdam
2005.03.03 18:04 "Re: [Tiff] LibTIFF question", by Bob Friesenhahn
2005.03.03 18:11 "Re: [Tiff] LibTIFF question", by Kalman Miklos
2005.03.03 18:28 "Re: [Tiff] LibTIFF question", by Frank Warmerdam
2005.03.15 00:38 "Re: [Tiff] LibTIFF question", by Joris Van Damme
2005.03.15 07:56 "Re: [Tiff] LibTIFF question", by Frank Warmerdam
2005.03.15 16:06 "Re: [Tiff] LibTIFF question", by Joris Van Damme
2005.03.15 16:15 "Re: [Tiff] LibTIFF question", by Frank Warmerdam
2005.03.15 16:34 "Re: [Tiff] LibTIFF question", by Bob Friesenhahn

2005.03.03 17:48 "Re: [Tiff] LibTIFF question", by Frank Warmerdam

If there is someone out there who knows LibTIFF please reply: I am using LibTIFF I need to read tag information from a TIFF file. I know the code of the tag (it is not a standard tag) and I want to use GetField to retrieve the information stored in it. I can get the size of it, but cannot retrieve the value.

I open the file:

m_TIFF = TIFFOpen((char *)(LPCTSTR)m_FileName, "r");
...

I can read the width:

if (TIFFGetField(m_TIFF, TIFFTAG_IMAGEWIDTH, &ui32Val) == 0) {
               m_Width = "n/a";
           } else {
               itoa(ui32Val, m_Width.GetBuffer(4), 10);
               m_Width.ReleaseBuffer();
           }
..

but I have a tagID 50653 with a length of 121 and I cannot read those bytes:

if (TIFFGetField(m_TIFF, 50653, &iVal) == 0) {
               m_PtiOptions = "n/a";
           } else {
               itoa(iVal, m_PtiOptions.GetBuffer(4), 10);
               m_PtiOptions.ReleaseBuffer();
           }

Miklos,

I think you should be doing something like:

  uint16 count;
  int *data = NULL;

  TIFFGetField( m_TIFF, 50653, &count, &data );

Fields that are not pre-defined are normally treated such that you have to pass the count into TIFFGetField. The returned pointer should be to an internal copy of the tag value.

It is also possible for you to register the custom tag to have more control, but that is likely overkill in this situation.

Also, it would be helpful for you to provide a "tiffdump" of the file with questions like this, or even a small example file with your tag (as an http or ftp link - not in the email).

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