Received: from [192.48.153.1] by phillip.thumbsplus.com (NTMail 3.03.0017/7.aaxh) with ESMTP id pcrews for <pcrews@cerious.com>; Wed, 10 Jun 1998 13:20:05 -0400
Received: from cthulhu.engr.sgi.com (cthulhu.engr.sgi.com [192.26.80.2]) by sgi.sgi.com (980309.SGI.8.8.8-aspam-6.2/980304.SGI-aspam: SGI does not authorize the use of its proprietary systems or networks for unsolicited or bulk email from the Internet.) via ESMTP id KAA21820; Wed, 10 Jun 1998 10:08:06 -0700 (PDT)
	mail_from (owner-tiff@sgi.engr.sgi.com)
Received: (from majordomo-owner@localhost)
	by cthulhu.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF)
	id JAA12198
	for tiff-list;
	Wed, 10 Jun 1998 09:10:16 -0700 (PDT)
	mail_from (owner-tiff@sgi.sgi.com)
Received: from sgi.sgi.com (sgi.engr.sgi.com [192.26.80.37])
	by cthulhu.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF)
	via ESMTP id JAA04992
	for <tiff-relay@cthulhu.engr.sgi.com>;
	Wed, 10 Jun 1998 09:10:15 -0700 (PDT)
	mail_from (owner-tiff@sgi.sgi.com)
Received: from wyatt.ummu.umich.edu (wyatt.ummu.umich.edu [141.213.34.189]) by sgi.sgi.com (980309.SGI.8.8.8-aspam-6.2/980304.SGI-aspam: SGI does not authorize the use of its proprietary systems or networks for unsolicited or bulk email from the Internet.) via ESMTP id JAA21647
	for <tiff@sgi.com>; Wed, 10 Jun 1998 09:10:12 -0700 (PDT)
	mail_from (steveg@umich.edu)
Received: from localhost (steveg@localhost)
	by wyatt.ummu.umich.edu (8.8.7/8.8.7) with ESMTP id MAA22379;
	Wed, 10 Jun 1998 12:10:02 -0400 (EDT)
Message-Id: <199806101610.MAA22379@wyatt.ummu.umich.edu>
To: steveg@umich.edu
cc: tiff@sgi.com
Subject: Re: TIFFGetField syntax and use 
In-reply-to: Your message of "Wed, 10 Jun 1998 11:54:11 EDT."
             <1D9682656FBAD01196FD00805FFE895E6CAECC@exchange.server.net> 
Date: Wed, 10 Jun 1998 12:09:58 -0400
From: Steven Michael Garcia <steveg@umich.edu>
Sender: owner-tiff@fddi-sgi.sgi.com
Precedence: bulk

Your Message:

>try this:
>
>#include <tiffio.h>
>int photo, bitspersample;
>
>main ()
>{
>	TIFF *tif = TIFFOpen("myfile.tif", "r");
>	TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photo);
>	TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample);
>	printf("Photo = %d, Bits/Sample = %d", photo, bitspersample);
>	TIFFClose(tif);
>}
>
>
>by the way, i suggest moving to C++ instead of C.  much better language.
>
>then for printing you can do this:
>
>cout << "Photo = " << photo << ", Bits/Sample = " << bitspersample << endl;
>
>see how you don't have to worry about the type of the data you are printing.
>:-)

After reading more of the man pages, I tried what you suggested above, by
sending the memory address.  Yet when I print out the photo and bits/sample
values, I get some awfully large numbers which I presume are memory address
locations like:

Photo = 4259841
Bits/Sample = 4259848

The funny thing is I have used TIFFGetField for other tags, and it seems
to work just fine.  For instance I did

TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &length);
printf("Image Length = %d", length);

and I get a correct printout.  I passed it the memory location and I was
able to access the value at that memory location (I retrieved 261).  So 
I'm wondering if there is something screwed up about the PHOTOMETRIC and
BITSPERSAMPLE tags which may not exist with other tags. 

Anyone else seen this problem?  Is there a completely different way of
accessing the data in those tags I mentioned above?

BTW, I plan on learning C++ soon...I know the advantages are numerous, I just
wanted to learn C first (I think on recommendation).  :-)  Then I can 
learn great things like Java, etc.

Steve

    /\         /^\   
   /^^\       /^^^\ 
  /    \/^\  /     \    
 /      \  \/       \  Steven Garcia        Graduate School, Bioengineering 
/        \  \        \ steveg@engin.umich.edu	           Univ. of Michigan 


