Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delete Layer?
#3
(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.
Reply


Messages In This Thread
Delete Layer? - by DaltonCalford - 11-29-2022, 02:46 PM
RE: Delete Layer? - by Ofnuts - 11-29-2022, 06:27 PM
RE: Delete Layer? - by DaltonCalford - 11-30-2022, 03:12 PM

Forum Jump: