title: How to read TIFF File headers in c?
body: <p>How can i read a tiff file header in c ?</p>
  
  <p>actually i want to learn TIFF Tag ImageWidth, and TIFF Tag ImageLength.</p>
  
  <p>how can i acces this attributes?</p>
  
  <p><a href="http://www.awaresystems.be/imaging/tiff/tifftags/imagewidth.html" rel="nofollow noreferrer">http://www.awaresystems.be/imaging/tiff/tifftags/imagewidth.html</a>
  <a href="http://www.awaresystems.be/imaging/tiff/tifftags/imagelength.html" rel="nofollow noreferrer">http://www.awaresystems.be/imaging/tiff/tifftags/imagelength.html</a></p>
  
  <p>the c translation of this code can help me :</p>
  
  <p><a href="https://stackoverflow.com/a/9071933/2079158">https://stackoverflow.com/a/9071933/2079158</a></p>
  
  <p>i don't know c well,<br>
   tried something like this :</p>
  
  <pre><code>#include "stdio.h"
  #include "stdlib.h"
  
  main()
  {
  FILE* f = fopen("tifo.tif", "rb");
  unsigned char info[500];
  fread(info, sizeof(unsigned char), 500, f); 
  
  long int width = *(long int*)&amp;info[256];
  short int height = *(short int*)&amp;info[257];
  
  printf("width : %d \n", width);
  printf("height : %d \n", height);
  
  fclose(f);
  }
  </code></pre>
  
  <p>what can i do for tiff files??</p>