[Gimp-user] script to delete layer



Hello to all! Again I am stuck with a problem with python script. I want to delete a layer, not only remove it from the image. The reason I want to do that is because while the script I did is running gimp increasily takes more and more memory, until a point that the script stops because there is no RAM left. My script duplicates layers, put them in the image, duplicate the image, exports and them removes the duplicated layers and image from it. But it seems that only removing the layers is not enough to liberate memory. Any help would be appreciated...

the pdb.gimp_item_delete function takes an item as parameter. So here is, more or less, what I am doing:

layer_to_be_deleted = gimp.Item.from_id(layer_id)
pdb.gimp_item_delete(layer_to_be_deleted)

This script cause this error:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
RuntimeError: execution error

I don't know what is going on. I am running gimp on a windows xp x64 sp2.

In the documentation, it says that the item can not be in the image when the function is called. But if I remove it from the image and then try to delete it, I get this error:

Calling error for procedure 'gimp-item-delete':
Procedure 'gimp-item-delete' has been called with value '25' for argument 'item' (#1, type GimpItemID). This value is out of range.

wich is expected, because the layer_to_be_deleted layer is not an Item anymore. It changes to a null, I think.

Well, if someone have some other tip on how can I make the script stop taking all the RAM memory of my machine, it would be very appreciated :)

--
Thiago






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]