Transparency of tif's using alpha-channel
NilsOJul 29 2009 — edited Aug 10 2009Hi,
input is a tif-file with 24bit color-depth (rgb) (total about 40 pictures).
Using gdal i reduced the existing color-values in the picture in range of 2-253 in each band. Afterwards the picture is warped creating a geoTiff-image having correct georeference-information. Problem with this: black boundaries where the picture was rotated - unusable for viewing in mapviewer etc.
1. In a next try I changed the warping: gdal now creates a geoTiff-File with black boundaries having alpha-values of 0 instead of 255 for black-pixels.
gdalwarp -s_srs EPSG:31466 -t_srs EPSG:900913 -co TFW=YES -dstalpha -dstnodata 0 translate_25665656.tif translate_warp_alpha0_25665656.tif
The black area now appears transparent in paint .Net or irfan-view - everything fine.
2. Using the importFrom-method of oracle spatial I import the file into a georaster-table
sdo_geor.importFrom(geor,'blocksize=(512,512) compression=deflate raster=true srid=3785','TIFF','file','\\folder\translate_warp_alpha0_25665656.tif','WORLDFILE','file','\\folder\translate_warp_alpha0_25665656.tfw');
Import succeeds
3. Viewing the file in mapviewer or georasterviewer shows the black borders (although paint etc. show them as transparent).
Using
SELECT
sdo_geor.getCellValue(georaster,0,0,0,0) L0, --red
sdo_geor.getCellValue(georaster,0,0,0,1) L1, --green
sdo_geor.getCellValue(georaster,0,0,0,2) L2, --blue
sdo_geor.getCellValue(georaster,0,0,0,3) L3 --alpha
FROM table WHERE georid=46;
shows:
L0 L1 L2 L3
---------- ---------- ---------- ----------
0 0 0 0
as result - the alpha-value is imported correctly.
Are there any known issues concerning alpha-values or transparency in georaster/mapbuilder? Is it possible, that this information isn't used when displaying an image?
I also tried setting a colormap for the picture, but got myself to ask, if this is possible for 24-bit images at all?
Does anybody know an easy/working way of how to "switch off" the black areas in the pictures?
Thanks in advance
NilsO