home *** CD-ROM | disk | FTP | other *** search
/ Internet File Formats / InternetFileFormatsCD.bin / graphics / tiff / unix / archive.z / archive / text0078.txt < prev    next >
Encoding:
Text File  |  1995-09-20  |  2.8 KB  |  83 lines

  1. Hi!
  2.  
  3. I have some trouble with tiff-v3.3beta021. The library is being used on a SGI
  4. INDY running IRIX 5.2.
  5.  
  6. My problem is related to the routine TIFFGetField and I have directed the
  7. problem to various NEWS groups as well - with no success. The files I have been
  8. testing at shows correct information using tiffdump. Furthermore, I have tested
  9. my program using both cc and gcc 2.6.3.
  10.  
  11. Description of the problem:
  12. When I use TIFFGetField to read the different fields correct information is
  13. gained from: TIFFTAG_IMAGEWIDTH, TIFFTAG_IMAGELENGTH, TIFFTAG_BITSPERSAMPLE,
  14. TIFFTAG_COMPRESSION, TIFFTAG_IMAGEDESCRIPTION, TIFFTAG_PHOTOMETRIC,
  15. TIFFTAG_STRIPOFFSETS, TIFFTAG_SAMPLESPERPIXEL and TIFFTAG_PLANARCONFIG while
  16. incorrect information is gained from TIFFTAG_ROWSPERSTRIP and
  17. TIFFTAG_STRIPBYTECOUNTS. The incorrect information show no resemblance with the
  18. "real" information.
  19.  
  20. Do You have any idea of what I am doing wrong?? I have run out of ideas.......
  21.  
  22.     Sincerely
  23.     Oystein
  24.  
  25. PS I have included part of the program:
  26.  
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29. #include <string.h>
  30.  
  31. #include "/usr/local/tiff-v3.3beta021/libtiff/tiffio.h"
  32.  
  33. main()
  34. {
  35.   TIFF *in;
  36.   uint32 imagewidth, imageheight, *offset;
  37.   uint16 samplesperpixel;
  38.   uint32 rowsperstrip;
  39.   uint32 *stripbytecounts;
  40.   uint16 bitspersample, compression, photomint, plcf;
  41.   char filename[19]= {"../data/test.tif"};
  42.  
  43. /* Open TIF file for reading of IFD and image data */
  44.  
  45.   in=TIFFOpen(filename, "r");
  46.  
  47. /* Read TIF tag information that is needed in the fortran program */
  48.  
  49.   TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &imagewidth);
  50.   TIFFGetField(in, TIFFTAG_IMAGELENGTH, &imageheight);
  51.   TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample);
  52.   TIFFGetField(in, TIFFTAG_COMPRESSION, &compression);
  53.   TIFFGetField(in, TIFFTAG_IMAGEDESCRIPTION, &description);
  54.   TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &photomint);
  55.   TIFFGetField(in, TIFFTAG_STRIPOFFSETS, &offset);
  56.   TIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
  57.   TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
  58.   TIFFGetField(in, TIFFTAG_STRIPBYTECOUNTS, &stripbytecounts);
  59.   TIFFGetField(in, TIFFTAG_PLANARCONFIG, &plcf);
  60.  
  61.   printf("%s %u\n", " Image width= ", imagewidth);
  62.   printf("%s %u\n", " Image height= ", imageheight);
  63.   printf("%s %u\n", " Bits per Sample= ", bitspersample);
  64.   printf("%s %u\n", " Compression= ", compression);
  65.   printf("%s %d\n", " Photometric= ", photomint);
  66.   printf("%s %u\n", " Strip offsets= ", *offset);
  67.   printf("%s %u\n", " Samples per pixel= ", samplesperpixel);
  68.   printf("%s %lu\n", " Rows per strip= ", rowsperstrip);
  69.   printf("%s %lu\n", " Strip byte counts: ", *stripbytecounts);
  70.   printf("%s %u\n", " Planar Configuration: ", plcf);
  71.  
  72.   printf("\n%s %s\n", " Description: ", description);
  73.  
  74. /* Close TIF file that have been used */
  75.  
  76.   TIFFClose(in);
  77.  
  78.   return;
  79. }
  80.  
  81.  
  82.  
  83.