[gdal-dev] gdal2tiles.py of transparent background vrt/png gives black background tiles

John W. Glendening glendening at drjack.net
Mon Apr 24 18:41:29 PDT 2017

Finally having some success using ImageMagick convert, I backed up by
not using its -Truecolor flag, i.e. using only a -depth 8 flag, which
produced a 4 band RGBA.  Creating a .vrt and running gdal2tiles.py
produced successful results, _without_ needing the -a 0,0,0,0
argument.  I then pushed things further by adding the partial opacity
polygons back in.  That did produce partial opacity polygons in the
tiles, but instead of being magenta they were gray.  Don't know how to
explain that, probably a limitation in gdal2tiles.py - but it is at
least partial success.

Summary: IM convert produced a "UInt16" format TIF when lines are
drawn on its blank transparent canvas, whereas drawing them on a
pre-created background map image produced "Byte" format TIFs.  The
gdalbuildvrt understood that and so indicated in the .vrt file it
produced.  But gdal2tiles.py apparently only understands "Byte" format
files.  The IM convert requires a "-depth 8" flag to produce such

John Glendening

John W. (Jack) Glendening  831-484-6929
25953 Deer Run Lane  Salinas, CA  93908

More information about the gdal-dev mailing list