[FWTools] gdal2tiles.py transparent png

Travis Kirstine traviskirstine at gmail.com
Fri Jan 4 13:39:24 EST 2008


All
It looks to me that the gdal2tiles.py does support the output of
transparent png (see below gdalinfo), the issue is not that the png
images are not transparent but that the kml file(s) stack mulitpule
png files over one another when utilizing the "image pyramid"
resulting in a non transparent image.  You can see what I mean by
creating a semi transparent ~%50 png with world file and running the
gdal2tiles utility on it.  View the image in g earth.  You will notice
that if you zoom out to the furthest extent the image will appear
transparent however as you zoom in and more images that are turned on
the image will appear opaque.


>gdalinfo -stats 0.png

Driver: PNG/Portable Network Graphics
Files: 0.png
Size is 256, 256
Coordinate System is `'
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  256.0)
Upper Right (  256.0,    0.0)
Lower Right (  256.0,  256.0)
Center      (  128.0,  128.0)
Band 1 Block=256x1 Type=Byte, ColorInterp=Red
  Minimum=0.000, Maximum=255.000, Mean=71.615, StdDev=82.279
  Mask Flags: PER_DATASET ALPHA
  Metadata:
    STATISTICS_MINIMUM=0
    STATISTICS_MAXIMUM=255
    STATISTICS_MEAN=71.61540222168
    STATISTICS_STDDEV=82.279002838268
Band 2 Block=256x1 Type=Byte, ColorInterp=Green
  Minimum=0.000, Maximum=241.000, Mean=50.926, StdDev=65.134
  Mask Flags: PER_DATASET ALPHA
  Metadata:
    STATISTICS_MINIMUM=0
    STATISTICS_MAXIMUM=241
    STATISTICS_MEAN=50.925872802734
    STATISTICS_STDDEV=65.134191162784
Band 3 Block=256x1 Type=Byte, ColorInterp=Blue
  Minimum=0.000, Maximum=153.000, Mean=30.245, StdDev=33.139
  Mask Flags: PER_DATASET ALPHA
  Metadata:
    STATISTICS_MINIMUM=0
    STATISTICS_MAXIMUM=153
    STATISTICS_MEAN=30.245269775391
    STATISTICS_STDDEV=33.138767484085
Band 4 Block=256x1 Type=Byte, ColorInterp=Alpha
  Minimum=0.000, Maximum=204.000, Mean=99.482, StdDev=101.969
  Metadata:
    STATISTICS_MINIMUM=0
    STATISTICS_MAXIMUM=204
    STATISTICS_MEAN=99.481750488281
    STATISTICS_STDDEV=101.96890908212

W:\Travis\hamiton_dem\dem_tiles\hamilton_dem_transparent\0\0>

On 03/01/2008, Luiz Motta <luizmottanet at hotmail.com> wrote:
> Travis,
>
> The transparency in image PNG is make with add more one band, called ALPHA,
> where define degree of transparency.
>
> When run the script, its make news image, but not use the ALPHA band.
>
> You have change the script add plus band, and populate for degree of
> transparency.
>
> I work for make this, but, in my case, i define transparency pixel, band
> ALPHA, when RGB is black (0,0,0).
> My program not finish i need make GUI.
>
> The min and max LOD not use for the transparency.
>
> PS: If you need algorithm for make transparency i send you.
>
> Luiz Motta
> Brasília-DF
> Brazil
>
>
>
> --------------------------------------------------
> From: "Travis Kirstine" <traviskirstine at gmail.com>
> Sent: Thursday, January 03, 2008 5:06 PM
> To: "FWTools" <FWTools at lists.maptools.org>
> Subject: [FWTools] gdal2tiles.py transparent png
>
> > Hi all,
> > I have been having some fun testing the gdal2tiles utility.  I have
> > specifically been using the output in google earth.  The problem that
> > I have found is that although my source png has a transparency the
> > resulting tiles/kml structure does not support transparency.  It looks
> > as though the utility has no difficulty creating the transparent png
> > files but the kml overlaps the GroundOverlays with resulting in a
> > opaque image.  Would it be possible to use the <minLod> <maxLod> tags
> > to control this behavior?
> > --
> > Travis K.
> >
> > Toronto, Canada
> > ------------------------------------------------------------
> > "She knows there's no success like failure
> > And that failure's no success at all."
> > -Bob Dylan-
> > ------------------------------------------------------------
> > _______________________________________________
> > FWTools mailing list
> > FWTools at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/fwtools
> > http://fwtools.maptools.org/
> >
>


-- 
Travis K.

Toronto, Canada
------------------------------------------------------------
"She knows there's no success like failure
And that failure's no success at all."
-Bob Dylan-
------------------------------------------------------------



More information about the FWTools mailing list