I'm exploring QGIS python functions to set all raster layers with a custom transparency, i.e 0,0,0,100 .
Looking at some previous questions. There is a way to loop all the layers, but the aspect to set transparency value on RGB values, I've been having difficulties understanding the documentation.
How to set the transparency for multiple layers or add a global transparancy preference?How to set the transparency for multiple layers or add a global transparancy preference?
for layer in iface.legendInterface().layers():
layer.renderer().setOpacity(0.2)
How do I set layer transparency in QGIS 2.0 with Python? The example here uses TransparentSingleValuePixel but i notice there is a TransparentThreevaluePixel
x = QgsRasterTransparency.TransparentSingleValuePixel()
x.pixelValue = 123
x.transparencyPercent = 50
rt.setTransparentSingleValuePixelList( [ x ] )