title: efficient TIFF tile extraction C++
body: <p>I am working with 1gb large tiff images of around 20000 x 20000 pixels. I need to extract several tiles (of about 300x300 pixels) out of the images, in random positions.</p>
  
  <p>I tried the following solutions:</p>
  
  <ul>
  <li><p>Libtiff (the only low level library I could find) offers TIFFReadline() but that means reading in around 19700 unnecesary pixels.</p></li>
  <li><p>I implemented my own tiff reader which extracts a tile out of the image without reading in unnecesary pixels. I expected it to be faster, but doing a seekg for every line of the tile makes it very slow. I also tried reading to a buffer all the lines of the file that include my tile, and then extracting the tile from the buffer, but results are more or less the same.</p></li>
  </ul>
  
  <p>I'd like to receive suggestions that would improve my tile extraction tool!</p>
  
  <p>Everything is welcome, maybe you can propose a more efficient library I could use, some tips about C/C++ I/O, some higher level strategy for my needs, etc.</p>
  
  <p>Regards,
  Juan</p>