简体   繁体   中英

How to raise dropshadow layer to top in gimp python

I create an image 500x500px, add a second layer to it, paint a black star from the brushes on it. Paint layer is active. I then go to the python console and enter following code:

>>> image = gimp.image_list()[0]
>>> layer = pdb.gimp_image_get_active_layer(image)
>>> schatten = pdb.script_fu_drop_shadow(image, layer, 4, 4, 15, "#000000", 80, FALSE)

This gives me a dropshadow. Now I want to move the shadow layer to the top by

>>> pdb.gimp_image_raise_item_to_top(image, schatten)

and get this error:

Traceback (most recent call last): File "", line 1, in RuntimeError: Die Prozedur »gimp-image-raise-item-to-top« wurden mit dem Wert »-1« für das Argument »item« (Nr. 2, Typ GimpItemID) aufgerufen. Dieser liegt außerhalb des Wertebereiches.

What am I doing wrong?

It doesn't work because you've made the assumption that script-fu-drop-shadow returns the id of the drop-shadow layer, but it doesn't return anything.

You will have to search for the layer, or look at the code for script-fu-drop-shadow to find out where it puts the layer relative to the source layer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM