Menu

How would I read an Image that is tiled in a memory efficent way?

Help
2016-07-30
2016-07-30
  • Damian Dixon

    Damian Dixon - 2016-07-30

    Hi,

    If I have a very large TIFF that is tiled how would I go about reading the tiles one by one?

    I need this to be efficent as possible.

    Currently I'm opening the file and croping to get essentially a block of data to process.

    Given that many large images are tiled I would like to read the data in the native tile/block size. If I read in a different block size to the native block size I would almost certainly cause more data to be read and decompressed than I need too.

    How would I be able find the native tile/block size?

    How would I then read a Tile of data efficently?

    Thanks
    Damian

     
    • Bob Friesenhahn

      Bob Friesenhahn - 2016-07-30

      On Sat, 30 Jul 2016, Damian Dixon wrote:

      Hi,

      If I have a very large TIFF that is tiled how would I go about reading the tiles one by one?

      I need this to be efficent as possible.

      Currently I'm opening the file and croping to get essentially a block of data to process.

      Given that many large images are tiled I would like to read the data in the native tile/block size. If I read in a different block size to the native block size I would almost certainly cause more data to be read and decompressed than I need too.

      How would I be able find the native tile/block size?

      How would I then read a Tile of data efficently?

      If you want to take advantage of tiles then you should use libtiff
      directly or use a library (e.g. GDAL, vips) which requests tiles from
      libtiff on demand.

      GraphicsMagick reads all of the tiles into a linear raster
      representation and so the entire image needs to be read and converted
      before you can use it.

      Bob

      --
      Bob Friesenhahn
      bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
      GraphicsMagick Maintainer, http://www.GraphicsMagick.org/

       

Log in to post a comment.