Search code examples
pythonimage-processinggdal

GDAL function to split large image into specific chunks


I would like to use GDAL if possible to split an image up to 3Gb into 100mb TIFs so that I can do processing on these smaller chunks. After the processing I would like to reconstruct these images(which will look different) back into their original positions to create one large TIF again. It seems like I can use ImageMagick to do this but I would like to stick with GDAL if possible.

So, what functions would I use in GDAL to split and then reconstruct chunks? retile.py? polygonize.py?


Solution

  • You can split the image into chunks/tiles with gdal2tiles. You could also split it into parts depending on the amount of pixels for each chunk using gdal_translate with the -srcwin option. This however would require you to write a bash/batch script to loop through your 30 image chunks.

    If your processing does not change the pixel size or spatial position the easiest way to mosaick them is to use gdal_merge.