11-29-2022, 02:46 PM
Hi Everyone, I have been learning script-fu but have hit a roadblock.
I have a script-fu script that works perfectly except that is will not delete a layer.
Here is the script, minus the variables so that it is easy to run in a console.
The script is written to run on an image with an image id of "1" so you may need to adjust depending upon your current environment.
((gimp-selection-none 1)
(gimp-item-set-visible (car(gimp-image-get-layer-by-name 1 "background" )) 1)
(gimp-image-set-active-layer 1 (car(gimp-image-get-layer-by-name 1 "background" )))
(gimp-image-insert-layer 1 (car (gimp-layer-new-from-drawable (car(gimp-image-get-active-drawable 1)) 1)) 0 0 )
(gimp-image-set-active-layer 1 (car(gimp-image-get-layer-by-name 1 "background copy" )))
(gimp-image-select-color 1 0 (car(gimp-image-get-layer-by-name 1 "1.png" )) '(0 0 0))
(script-fu-add-bevel 1 (car(gimp-image-get-layer-by-name 1 "background copy" )) 5 0 0 )
(script-fu-add-bevel 1 (car(gimp-image-get-layer-by-name 1 "background copy" )) 5 0 0 )
(gimp-selection-invert 1)
(gimp-drawable-edit-clear (car(gimp-image-get-layer-by-name 1 "background copy" )))
(gimp-item-set-visible (car(gimp-image-get-layer-by-name 1 "background" )) 0)
(gimp-file-save 0 1 (car(gimp-image-get-layer-by-name 1 "background copy" )) "Style_A_1.png" "Style_A_1.png")
(gimp-item-delete (car(gimp-image-get-layer-by-name 1 "background copy" ))))
Error: Procedure execution of gimp-item-delete failed
I have tried deleting it by the id alone in the console ie (gimp-item-delete 13589 )
with the same results.
Any examples or guidance would be appreciated.
best regards
Dalton
I have a script-fu script that works perfectly except that is will not delete a layer.
Here is the script, minus the variables so that it is easy to run in a console.
The script is written to run on an image with an image id of "1" so you may need to adjust depending upon your current environment.
((gimp-selection-none 1)
(gimp-item-set-visible (car(gimp-image-get-layer-by-name 1 "background" )) 1)
(gimp-image-set-active-layer 1 (car(gimp-image-get-layer-by-name 1 "background" )))
(gimp-image-insert-layer 1 (car (gimp-layer-new-from-drawable (car(gimp-image-get-active-drawable 1)) 1)) 0 0 )
(gimp-image-set-active-layer 1 (car(gimp-image-get-layer-by-name 1 "background copy" )))
(gimp-image-select-color 1 0 (car(gimp-image-get-layer-by-name 1 "1.png" )) '(0 0 0))
(script-fu-add-bevel 1 (car(gimp-image-get-layer-by-name 1 "background copy" )) 5 0 0 )
(script-fu-add-bevel 1 (car(gimp-image-get-layer-by-name 1 "background copy" )) 5 0 0 )
(gimp-selection-invert 1)
(gimp-drawable-edit-clear (car(gimp-image-get-layer-by-name 1 "background copy" )))
(gimp-item-set-visible (car(gimp-image-get-layer-by-name 1 "background" )) 0)
(gimp-file-save 0 1 (car(gimp-image-get-layer-by-name 1 "background copy" )) "Style_A_1.png" "Style_A_1.png")
(gimp-item-delete (car(gimp-image-get-layer-by-name 1 "background copy" ))))
Error: Procedure execution of gimp-item-delete failed
I have tried deleting it by the id alone in the console ie (gimp-item-delete 13589 )
with the same results.
Any examples or guidance would be appreciated.
best regards
Dalton