1995.01.10 15:12 "Problem with tiff-v3.3beta021", by Oystein Godoy
Hi!
I have some trouble with tiff-v3.3beta021. The library is being used on a SGI INDY running IRIX 5.2.
My problem is related to the routine TIFFGetField and I have directed the problem to various NEWS groups as well - with no success. The files I have been testing at shows correct information using tiffdump. Furthermore, I have tested my program using both cc and gcc 2.6.3.
Description of the problem:
When I use TIFFGetField to read the different fields correct information is gained from: TIFFTAG_IMAGEWIDTH, TIFFTAG_IMAGELENGTH, TIFFTAG_BITSPERSAMPLE, TIFFTAG_COMPRESSION, TIFFTAG_IMAGEDESCRIPTION, TIFFTAG_PHOTOMETRIC, TIFFTAG_STRIPOFFSETS, TIFFTAG_SAMPLESPERPIXEL and TIFFTAG_PLANARCONFIG while incorrect information is gained from TIFFTAG_ROWSPERSTRIP and TIFFTAG_STRIPBYTECOUNTS. The incorrect information show no resemblance with the "real" information.
Do You have any idea of what I am doing wrong?? I have run out of ideas.......
Sincerely
Oystein
PS I have included part of the program:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "/usr/local/tiff-v3.3beta021/libtiff/tiffio.h"
main()
{
TIFF *in;
uint32 imagewidth, imageheight, *offset;
uint16 samplesperpixel;
uint32 rowsperstrip;
uint32 *stripbytecounts;
uint16 bitspersample, compression, photomint, plcf;
char filename[19]= {"../data/test.tif"};
/* Open TIF file for reading of IFD and image data */
in=TIFFOpen(filename, "r");
/* Read TIF tag information that is needed in the fortran program */
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &imagewidth);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &imageheight);
TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample);
TIFFGetField(in, TIFFTAG_COMPRESSION, &compression);
TIFFGetField(in, TIFFTAG_IMAGEDESCRIPTION, &description);
TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &photomint);
TIFFGetField(in, TIFFTAG_STRIPOFFSETS, &offset);
TIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
TIFFGetField(in, TIFFTAG_STRIPBYTECOUNTS, &stripbytecounts);
TIFFGetField(in, TIFFTAG_PLANARCONFIG, &plcf);
printf("%s %u\n", " Image width= ", imagewidth);
printf("%s %u\n", " Image height= ", imageheight);
printf("%s %u\n", " Bits per Sample= ", bitspersample);
printf("%s %u\n", " Compression= ", compression);
printf("%s %d\n", " Photometric= ", photomint);
printf("%s %u\n", " Strip offsets= ", *offset);
printf("%s %u\n", " Samples per pixel= ", samplesperpixel);
printf("%s %lu\n", " Rows per strip= ", rowsperstrip);
printf("%s %lu\n", " Strip byte counts: ", *stripbytecounts);
printf("%s %u\n", " Planar Configuration: ", plcf);
printf("\n%s %s\n", " Description: ", description);
/* Close TIF file that have been used */
TIFFClose(in);
return;
}