[Qgis-developer] transparency for all raster in the group

Martin Dobias wonder.sk at gmail.com
Sun Dec 21 06:10:43 PST 2014

Hi Martin

On Thu, Dec 18, 2014 at 3:35 AM, Martin Landa <landa.martin at gmail.com>
> is it possible in QGIS to change transparency for all rasters in the
> group? Or is there any plugin for that?

Not sure if there is any plugin for that - but the code to do it is simple
(in QGIS >= 2.4).

Assuming your group is the first item in the layer tree:

root = QgsProject.instance().layerTreeRoot()
group = root.children()[0]

for ch in group.children():
  if isinstance(ch, QgsLayerTreeLayer) and isinstance(ch.layer(),

(opacity should be in range 0-1)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20141221/0d461c7d/attachment.html>

More information about the Qgis-developer mailing list