Skip to main content
typos, small fix in range.
Source Link
jsbueno
  • 5.3k
  • 22
  • 21

It is feasible from the Python Console window. Opacity is a layer property, so it is possible to set it with a simple attribution.

Go to filters->Python Fu->Console - there you can type Python expressions. The first one you want is to get a reference to your image - for example: img = gimp.image_list()[0] (press enterafterwards) willgt will get you a reference to the latest (rightmost tab) open image in GIMP. (increase the numbers from 0 inside the brackets to get to the other images)

The layers are available as a Python list when you ypetype img.layers, and the opacity varies from 0.0 to 100.0 - so, the first thing to do is to calculate how much you want to increase the opacity from one layer to the next - that number is: opacity_step = 100.0 / (len(img.layers) - 1) (just type the variable names, like img and opacity_step by themselves and press enter to check their values). Now, just pick a starting opacity - ex. current_opacity = 0.0 and then iterate over all layers with a for command, setting the opacity. So, putting everything together, you should type:

img = gimp.image_list()[0]
opacity_step = 100.0 / (len(img.layers) - 1)
current_opacity = 0.0
for layer in reversed(img.layers):
    layer.opacity = current_opacity
    current_opacity += opacity_step

It is feasible from the Python Console window. Opacity is a layer property, so it is possible to set it with a simple attribution.

Go to filters->Python Fu->Console - there you can type Python expressions. The first one you want is to get a reference to your image - for example: img = gimp.image_list()[0] (press enterafterwards) willgt you a reference to the latest (rightmost tab) open image in GIMP. (increase the numbers from 0 inside the brackets to get to the other images)

The layers are available as a Python list when you ype img.layers, and the opacity varies from 0.0 to 100.0 - so, the first thing to do is to calculate how much you want to increase the opacity from one layer to the next - that number is: opacity_step = 100.0 / len(img.layers) (just type the variable names, like img and opacity_step by themselves and press enter to check their values). Now, just pick a starting opacity - ex. current_opacity = 0.0 and then iterate over all layers with a for command, setting the opacity. So, putting everything together, you should type:

img = gimp.image_list()[0]
opacity_step = 100.0 / len(img.layers)
current_opacity = 0.0
for layer in reversed(img.layers):
    layer.opacity = current_opacity
    current_opacity += opacity_step

It is feasible from the Python Console window. Opacity is a layer property, so it is possible to set it with a simple attribution.

Go to filters->Python Fu->Console - there you can type Python expressions. The first one you want is to get a reference to your image - for example: img = gimp.image_list()[0] (press enterafterwards) will get you a reference to the latest (rightmost tab) open image in GIMP. (increase the numbers from 0 inside the brackets to get to the other images)

The layers are available as a Python list when you type img.layers, and the opacity varies from 0.0 to 100.0 - so, the first thing to do is to calculate how much you want to increase the opacity from one layer to the next - that number is: opacity_step = 100.0 / (len(img.layers) - 1) (just type the variable names, like img and opacity_step by themselves and press enter to check their values). Now, just pick a starting opacity - ex. current_opacity = 0.0 and then iterate over all layers with a for command, setting the opacity. So, putting everything together, you should type:

img = gimp.image_list()[0]
opacity_step = 100.0 / (len(img.layers) - 1)
current_opacity = 0.0
for layer in reversed(img.layers):
    layer.opacity = current_opacity
    current_opacity += opacity_step
Source Link
jsbueno
  • 5.3k
  • 22
  • 21

It is feasible from the Python Console window. Opacity is a layer property, so it is possible to set it with a simple attribution.

Go to filters->Python Fu->Console - there you can type Python expressions. The first one you want is to get a reference to your image - for example: img = gimp.image_list()[0] (press enterafterwards) willgt you a reference to the latest (rightmost tab) open image in GIMP. (increase the numbers from 0 inside the brackets to get to the other images)

The layers are available as a Python list when you ype img.layers, and the opacity varies from 0.0 to 100.0 - so, the first thing to do is to calculate how much you want to increase the opacity from one layer to the next - that number is: opacity_step = 100.0 / len(img.layers) (just type the variable names, like img and opacity_step by themselves and press enter to check their values). Now, just pick a starting opacity - ex. current_opacity = 0.0 and then iterate over all layers with a for command, setting the opacity. So, putting everything together, you should type:

img = gimp.image_list()[0]
opacity_step = 100.0 / len(img.layers)
current_opacity = 0.0
for layer in reversed(img.layers):
    layer.opacity = current_opacity
    current_opacity += opacity_step