'Splitting a geo-image into tiles, removing/ignoring empty tiles when using gdal2tiles in python?

I am using gdal2tiles in python. It all works well. In gdal the flag -x can be used to ignore empty tiles, however in the gdal2tiles documentation there does not appear to be an option for this functionality.

The python library works like this:

gdal2tiles.generate_tiles('input_file', 'output_dir/', **options)

Various options are available, I use it like so:

    options = {'zoom': [zoom_min, zoom_max],
               'nb_processes': nb_processes,
               'resume': resume,
               'tile_size': tile_size,
               'verbose': verbose,
               'webviewer': webviewer
        }
    
    gdal2tiles.generate_tiles(source_path, destination_path, **options)

Is there an option like 'ignore_blank_tiles': True?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source