Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4-band images with ColorInterp=Alpha are not transparent #90

Open
howff opened this issue Nov 9, 2024 · 3 comments
Open

4-band images with ColorInterp=Alpha are not transparent #90

howff opened this issue Nov 9, 2024 · 3 comments

Comments

@howff
Copy link
Contributor

howff commented Nov 9, 2024

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?

@gillins
Copy link
Member

gillins commented Nov 10, 2024

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!).

@howff
Copy link
Contributor Author

howff commented Nov 12, 2024

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.

@gillins
Copy link
Member

gillins commented Nov 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants