11-30-2022, 03:12 PM
(11-29-2022, 06:27 PM)Ofnuts Wrote: To remove a layer use (gimp-image-remove-layer image layer) (this releases the memory).
IMHO you script would be more robust if you start by setting a variable to the layer returned by gimp-layer-new-from-drawable and then use this variable instead of calling gimp-image-get-layer-by-name, because you script will fail if there is already a "background copy". Your background layer is also the last of the layers is the list, so you don't need its name...
Hi Ofnuts,
Interesting, the Script-Fu Procedure Browser when searching for gimp-layer-delete specifies to use gimp-item-delete and does not mention "gimp-image-remove-layer"
That was the key to success.
I use variables in my actual script, but wanted to provide a quick code example that would run in the console without lots of variables.
I just used background as a layer name as a safe example name vs the actual layer names.
I like what I can do with script-fu, but, the documentation leaves a lot to be desired.
Thanks for your help.