[gdal-dev] Problems to define trancparency

Chaitanya kumar CH chaitanya.ch at gmail.com
Mon Nov 28 08:16:03 EST 2011


Jan,

Your original image has a color table with RGBA values. Since it includes
the alpha channel, you can just modify the color table to set the entry for
0 to (0,0,0,0). With a 0 value for alpha, the pixels with 0 value will be
transparent.

But you can set it using the VRT format. This method has been discussed in
this list earlier[1]. However, you have to reapply the whole table's
entries.

It might be easier to change the color table using a desktop GIS
application.

[1]: http://lists.osgeo.org/pipermail/gdal-dev/2011-May/028854.html

On Mon, Nov 28, 2011 at 4:40 PM, Jan Tappenbeck <tappenbeck at widemann.de>wrote:

>
>
>  HI !
>
> after my problems to transform rasterimage now i have a problem to make
> the white background tranparency.
>
> After the translation the new image had following status:
>
> C:\Program Files (x86)\FWTools2.4.7>gdalinfo "D:\City\raster\gas\500\twf_*
> *chec
> k\baseline_etrs.tif"
> Driver: GTiff/GeoTIFF
> Files: D:\City\raster\gas\500\twf_**check\baseline_etrs.tif
> Size is 16568, 9564
> Coordinate System is:
> PROJCS["ETRS89 / UTM zone 32N",
>    GEOGCS["ETRS89",
>        DATUM["European_Terrestrial_**Reference_System_1989",
>            SPHEROID["GRS 1980",6378137,298.**2572221010002,
>                AUTHORITY["EPSG","7019"]],
>            AUTHORITY["EPSG","6258"]],
>        PRIMEM["Greenwich",0],
>        UNIT["degree",0.**0174532925199433],
>        AUTHORITY["EPSG","4258"]],
>    PROJECTION["Transverse_**Mercator"],
>    PARAMETER["latitude_of_origin"**,0],
>    PARAMETER["central_meridian",**9],
>    PARAMETER["scale_factor",0.**9996],
>    PARAMETER["false_easting",**500000],
>    PARAMETER["false_northing",0],
>    UNIT["metre",1,
>        AUTHORITY["EPSG","9001"]],
>    AUTHORITY["EPSG","25832"]]
> Origin = (380297.397497169380000,**5745229.623735004100000)
> Pixel Size = (0.032091644585721,-0.**032091644585721)
> Metadata:
>  AREA_OR_POINT=Area
> Image Structure Metadata:
>  INTERLEAVE=BAND
> Corner Coordinates:
> Upper Left  (  380297.397, 5745229.624) (  7d15'44.21"E, 51d50'42.10"N)
> Lower Left  (  380297.397, 5744922.699) (  7d15'44.59"E, 51d50'32.17"N)
> Upper Right (  380829.092, 5745229.624) (  7d16'11.98"E, 51d50'42.51"N)
> Lower Right (  380829.092, 5744922.699) (  7d16'12.36"E, 51d50'32.58"N)
> Center      (  380563.245, 5745076.161) (  7d15'58.29"E, 51d50'37.34"N)
> Band 1 Block=16568x1 Type=Byte, ColorInterp=Palette
>  Color Table (RGB with 256 entries)
>    0: 255,255,255,255
>    1: 0,0,0,255
>    2: 0,0,0,255
>    3: 0,0,0,255
>    4: 0,0,0,255
>    5: 0,0,0,255
>    6: 0,0,0,255
>    7: 0,0,0,255
>    8: 0,0,0,255
>    9: 0,0,0,255
>   10: 0,0,0,255
>   11: 0,0,0,255
>   12: 0,0,0,255
>   13: 0,0,0,255
>   14: 0,0,0,255
> ....
>
> i try to make the image transparency by
>
> C:\Program Files (x86)\FWTools2.4.7>gdalwarp -srcnodata 0 -dstalpha
> "D:\City\
> raster\gas\500\twf_check\**baseline_etrs.tif" "D:\City\raster\gas\500\twf_
> **check
> \baseline_etrs_t.tif"
> Copying color table from D:\City\raster\gas\500\twf_**check\baseline_etrs.tif
> t
> o new file.
> Creating output file that is 16568P x 9564L.
> ERROR 6: SetColorTable() not supported for multi-sample TIFF files.
> Processing input file D:\City\raster\gas\500\twf_**
> check\baseline_etrs.tif.
>
> but there comes the message "ERROR 6: SetColorTable() not supported for
> multi-sample TIFF files." and the result image is only 1 Color !!!!!!!!
>
> the status now is
> C:\Program Files (x86)\FWTools2.4.7>gdalinfo "D:\City\raster\gas\500\twf_*
> *chec
> k\baseline_etrs_t.tif"
> Driver: GTiff/GeoTIFF
> Files: D:\City\raster\gas\500\twf_**check\baseline_etrs_t.tif
> Size is 16568, 9564
> Coordinate System is:
> PROJCS["ETRS89 / UTM zone 32N",
>    GEOGCS["ETRS89",
>        DATUM["European_Terrestrial_**Reference_System_1989",
>            SPHEROID["GRS 1980",6378137,298.**2572221010002,
>                AUTHORITY["EPSG","7019"]],
>            AUTHORITY["EPSG","6258"]],
>        PRIMEM["Greenwich",0],
>        UNIT["degree",0.**0174532925199433],
>        AUTHORITY["EPSG","4258"]],
>    PROJECTION["Transverse_**Mercator"],
>    PARAMETER["latitude_of_origin"**,0],
>    PARAMETER["central_meridian",**9],
>    PARAMETER["scale_factor",0.**9996],
>    PARAMETER["false_easting",**500000],
>    PARAMETER["false_northing",0],
>    UNIT["metre",1,
>        AUTHORITY["EPSG","9001"]],
>    AUTHORITY["EPSG","25832"]]
> Origin = (380297.397497169380000,**5745229.623735004100000)
> Pixel Size = (0.032091644585733,-0.**032091644585733)
> Metadata:
>  AREA_OR_POINT=Area
> Image Structure Metadata:
>  INTERLEAVE=PIXEL
> Corner Coordinates:
> Upper Left  (  380297.397, 5745229.624) (  7d15'44.21"E, 51d50'42.10"N)
> Lower Left  (  380297.397, 5744922.699) (  7d15'44.59"E, 51d50'32.17"N)
> Upper Right (  380829.092, 5745229.624) (  7d16'11.98"E, 51d50'42.51"N)
> Lower Right (  380829.092, 5744922.699) (  7d16'12.36"E, 51d50'32.58"N)
> Center      (  380563.245, 5745076.161) (  7d15'58.29"E, 51d50'37.34"N)
> Band 1 Block=16568x1 Type=Byte, ColorInterp=Gray
>  Mask Flags: PER_DATASET ALPHA
> Band 2 Block=16568x1 Type=Byte, ColorInterp=Alpha
>
> Can anyone help me ??
>
> reagards Jan :-)
>
>
>
>
> ______________________________**_________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/**mailman/listinfo/gdal-dev<http://lists.osgeo.org/mailman/listinfo/gdal-dev>
>



-- 
Best regards,
Chaitanya kumar CH.

+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111128/b7e77feb/attachment-0001.html


More information about the gdal-dev mailing list