tuiview icon indicating copy to clipboard operation
tuiview copied to clipboard

4-band images with ColorInterp=Alpha are not transparent

Open howff opened this issue 1 year ago • 3 comments

I can't work out how to edit the Stretch settings so that a 4-band GeoTIFF where band4 ColorInterp=Alpha is transparent.

Or is transparency not supported?

howff avatar Nov 09 '24 13:11 howff

Currently this is not supported - tuiview just currently uses the no data value (if set) to determine the alpha value (transparent when value is no data). I haven't come across data sets that use band4 for alpha in my work, but agree it would be nice to support. I'll look into this after the next release (unless you beat me to it!).

gillins avatar Nov 10 '24 03:11 gillins

Thanks for the explanation. I've tried a 3-band image with NoData but still don't see any transparency. (Also, none of the 3 colour pickers NoData,Background,NaN seem to make any difference).

I'm familiar with Qt and GDAL and Python but not TuiView so can't quite understand how/where in the code this is handled. I can see references to alpha but don't understand why it's not working, nor how I might change it to use the alpha band.

howff avatar Nov 12 '24 16:11 howff

So the nodata is set to a value that occurs in your image?

The default colour for nodata is set here: https://github.com/ubarsc/tuiview/blob/master/tuiview/viewerstretch.py#L66. The nodata mask is created here: https://github.com/ubarsc/tuiview/blob/master/tuiview/viewerlayers.py#L926. The alpha is set here: https://github.com/ubarsc/tuiview/blob/master/tuiview/viewerLUT.py. It is complicated...

I've just done a test with showing a white image behind a raster that has black nodata around the edges. The white image (underneath) appears to show through where there is nodata: image

gillins avatar Nov 15 '24 04:11 gillins

PR #106 has implemented support for RGBA images to allow transparency to be read from band 4, thank you very much

howff avatar May 16 '25 14:05 howff