AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
November 2004

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2004.11.18 18:05 "Using TIFFGetField to get a "Rational"", by Stephen Billard
2004.11.18 19:40 "Re: Using TIFFGetField to get a "Rational"", by Ulf Zibis
2004.11.18 19:55 "Re: Using TIFFGetField to get a "Rational"", by Joris Van Damme
2004.11.18 20:16 "Re: Using TIFFGetField to get a "Rational"", by Eric Vergnaud
2004.11.18 22:30 "Re: Using TIFFGetField to get a "Rational"", by Joris Van Damme
2004.11.19 00:17 "Re: Using TIFFGetField to get a "Rational"", by Eric Vergnaud
2004.11.19 00:35 "Re: Using TIFFGetField to get a "Rational"", by Bob Friesenhahn
2004.11.19 00:49 "Re: Using TIFFGetField to get a "Rational"", by Eric Vergnaud
2004.11.19 00:52 "Re: Using TIFFGetField to get a "Rational"", by Joris Van Damme
2004.11.19 01:29 "Re: Using TIFFGetField to get a "Rational"", by Bob Friesenhahn
2004.11.19 01:38 "Re: Using TIFFGetField to get a "Rational"", by Joris Van Damme
2004.11.19 17:51 "Autoreply to the list - Yes or No ?", by Ulf Zibis
2004.11.19 22:03 "Re: Autoreply to the list - Yes or No ?", by Joris Van Damme
2004.11.20 15:33 "Re: Autoreply to the list - Yes or No ?", by Ulf Zibis
2004.11.20 17:22 "Re: Autoreply to the list - Yes or No ?", by Joris Van Damme
2004.11.19 00:42 "Re: Using TIFFGetField to get a "Rational"", by Joris Van Damme
2004.11.19 17:29 "Re: Using TIFFGetField to get a "Rational"", by Ulf Zibis
2004.11.19 17:43 "Re: Using TIFFGetField to get a "Rational"", by Bob Friesenhahn
2004.11.19 21:26 "Re: Using TIFFGetField to get a "Rational"", by Joris Van Damme
2004.11.20 15:21 "Re: Using TIFFGetField to get a "Rational"", by Ulf Zibis
2004.11.20 16:57 "Re: Using TIFFGetField to get a "Rational"", by Bob Friesenhahn
2004.11.20 17:27 "Re: Using TIFFGetField to get a "Rational"", by Joris Van Damme
2004.11.20 17:35 "Re: Using TIFFGetField to get a "Rational"", by Chris Losinger
2004.11.23 20:35 "Re: Using TIFFGetField to get a "Rational"", by Andrey Kiselev
2004.11.18 19:48 "Re: Using TIFFGetField to get a "Rational"", by Joris Van Damme
2004.11.23 14:58 "Using TIFFGetField to get a "Rational"", by Frank Warmerdam
2004.11.23 15:29 "Re: Using TIFFGetField to get a "Rational"", by Eric Vergnaud
2004.11.23 20:34 "Re: Using TIFFGetField to get a "Rational"", by Andrey Kiselev

2004.11.23 20:34 "Re: Using TIFFGetField to get a "Rational"", by Andrey Kiselev

On Thu, Nov 18, 2004 at 10:05:44AM -0800, Stephen Billard wrote:
> I am new to LibTIFF. I want to get the ResolutionUnit, XResolution,
> and YResolution from a TIFF file. I have no problem getting the
> Resolution unit. (Although I did see a strange behavior. If I had not
> initialized the variable that receives the ResolutionUnit value before
> calling TIFFGetField, I did not get back the value. If I initialize
> the variable to 0, I get back the correct unit.)

That is strange. If the file lacks ResolutionUnit tag the variable remains
unchanged. In that case you can get a garbage in the variable if it was
not properly initialized. I'm recommend using TIFFGetFieldDefaulted()
for tags for which default value defined by specification. I'm recommend
always initialize variables with a reasonable value.

> I am having no luck with the X & Y Resolutions. I suspect that I don't
> know what kind of variable to receive the "Rational" result. I tried a
> Real and got garbage back. What should I be using? (I get no errors
> back from calling TIFFGetField.)

You should use float (32-bit floating point value). The following code 
should work for you:

	uint16 res_unit;
	float xres = 0.0F, yres = 0.0F;

	TIFFGetFieldDefaulted(tif, TIFFTAG_RESOLUTIONUNIT, &res_unit);
    	TIFFGetField(tif, TIFFTAG_XRESOLUTION, &xres);
   	TIFFGetField(tif, TIFFTAG_YRESOLUTION, &yres);
    

						Andrey

-- 
Andrey V. Kiselev
Home phone:  +7 812 5970603  ICQ# 26871517