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

John W. Glendening glendening at drjack.net
Mon Apr 24 15:34:27 PDT 2017


BTW, I should have mentioned that using -a 0,0,0 worked for the version
that I obtained from the osgeo site, and with a GDAL 2.1.0 version, but
not for the 
GDAL 1.11 version I had been using.

But I spoke too soon.  Indeed the expected transparent areas are now
transparent,
but all the lines are now black - except for a few places where they
have some small patches of color.  I've been working to figure this out
but with no solution.  

() Since I was now using a different version of gdal2tiles.py, as a
test I re-ran the non-transparent background case using that - it was
successful.

() I have been using a vrt created from separately created TIF file,
so for testing decided to work only with a single TIF file.  I
created a .vrt file from than and ran gdal2tiles.py on that - it gave
"bad" results i.e. black lines except for some blotches of color

() The .TIF is not geo-referenced, hence my use of a .vrt.  But that
was only necessary when I had multiple TIFs, so I used gdal_translate
(with a specified srs) to convert the TIF to a geo-referenced TIF.  But
the result as also "bad"

() The TIF was created using ImageMagick convert to draw lines on a
transparent canvas to create a TIF file.  It appears as expected when
viewed with IM "display".  But to check it I separately extracted and
viewed all 4 channels.  All appeared as expected.

() I re-ran gdal2tiles.py _without_ "-a 0,0,0,0" to now view the
results more critically and noticed that the drawn lines were
_not_ in their expected places - and many more lines were being
displayed
that should be.  Moreover, each line was not solid but was had 1 pixel
horizontal black lines running through them.

() Comparing to the transparent case, I now see that the color patches
occurring on the black lines of the latter occur where they are
crossed by one of the colored lines of the non-transparent case.

() My best interpretation is that the alpha layer is being applied
correctly, since lines do appear where expected.  But for some reason
the RGB layers are not getting interpreted correctly.  It makes me
wonder whether the TIF has some sort of interlacing that is not being
recognized.  But while that might make sense when the IM-produced .TIF
file is used, I would think that the gdal_translate output TIF would
not have that problem.

() I should note that all TIF files mentioned look as expected when
viewed with either IM  or "Eye of Gnome" or Gwenview viewers.

So am at a loss as to why gdal2tiles.py is not correctly treating this
TIF file. Any thoughts would be appreciated!



John W. (Jack) Glendening



More information about the gdal-dev mailing list