Hi

I am fighting around with transparency in classification raster images. 

The one way:
(GDAL 1.4.0.0, released 2007/01/02, The srcnodata is right)
> gdalwarp -srcnodata 0 -dstnodata 0 ../landuse.img landuse.tif

When i import that GeoTiff, they have an IndexedColorModel and classes/values 
1 to 12 have correct colors,. Other values don't exist and don't have colors. 
All good, but no transparency on the sides!

The second way:
>GDAL 1.4.0.0, released 2007/01/02>gdalwarp -dstalpha -srcnodata 0 -dstnodata 
0 ../landuse.img landuse2.tif

When i import that GeoTiff, i don't have an IndexedColorModel, but just a 
ColorModel (?). Alpha and transparency are enabled (at least the methods of 
the planar Image say so..)

This is roughly how to am testing this...
> // I use GeoTiffReader,
> GeoTiffReader reader = new GeoTiffReader(file,hints);
> GridCoverage2D gc = (GridCoverage2D)reader.read(null);
> Object o = prop.get("tile_cache_key");
> PlanarImage  pi = (PlanarImage) o;
>               pi = ImageUtilities.componentColorModel2IndexColorModel4GIF(pi);
>
> ColorModel colorModel = pi.getColorModel();
> log.debug("cm= "+colorModel);
> log.debug("hasAlpha = "+icm.hasAlpha());

BUT the colors for values 1 to 12 are gone! I get a black and white image, 
which is very dark, as only values 1 to 12 exist, and it look like 0 to 255 
are streched from black to white. :-(
But transparency seems to work outside the are of values...

So the first way i have the colors i need, the second way i get the 
transparency. Any hints for me?

THE HOPE:
I would love to hear, that i could use the first import method, where i get 
the right colors in an IndexedColorModel, and just designate one value as 
transparent... So a kind of simple transparency like GIF uses... is that 
possible for a MapLayer or a Gricoverage2D ???

Many thanks

Stefan from Bonn, 
germany

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to