0

I have got a large TIFF file (~160000x50000 px @ 3,5 GB) and I need to extract PNG tiles of 256x256 px out of it in order to overlay it on a map.

I tried ImageMagick with magick stream -extract 256x256+xOffset+yOffset source.tif tileXXX.png but there was no result beside my pc building a huge cache file and quit working.

How can this task be approached efficiently?

DPF
  • 270
  • 1
  • 2
  • 12
  • that's 8 gigapixels... probably challenging to keep that in RAM, so it better not be compressed in any inconvenient way -- https://pypi.org/project/tifffile/ and check if you can memory-map your file. – Christoph Rackwitz Dec 07 '21 at 15:27
  • 2
    Try with `vips` https://stackoverflow.com/questions/tagged/vips – Mark Setchell Dec 07 '21 at 15:53
  • ```vips``` is doing great! I used ```vips dzsave source.tif tilesFolder --depth one --tile-size 256``` and it worked like a charm. – DPF Dec 08 '21 at 10:12
  • Cool. Consider writing up your findings as an answer for others to learn from. You can also accept your own answer and grab the points. – Mark Setchell Dec 08 '21 at 22:59
  • 2
    You probably need `--overlap 0` as well. `dzsave` will write tiles with the deepzoom convention by default, which is to have a few rows and columns of pixels shared between neighbouring tiles. – jcupitt Dec 09 '21 at 10:26
  • 1
    See also https://stackoverflow.com/questions/10853119/chop-image-into-tiles-using-vips-command-line/ – jcupitt Dec 09 '21 at 10:28

0 Answers0