I would like to add a drop shadow to picture files without using the Gimp UI. I've saved this content to ~~/.config/GIMP/2.10/scripts/my.scm~:
(define (my/add-drop-shadow filename)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
;; Apply transformations
(script-fu-drop-shadow RUN-NONINTERACTIVE image drawable
20.0 20.0 10.0 0 0.5 nil)))
(I know this code is not saving the image, I will add that when this works).
Unfortunately, when trying to use that, I get an error:
$ gimp --version
2.10.30
$ gimp -i -b '(my/add-drop-shadow "2022-11-01-080429.png")' -b '(gimp-quit 0)'
GIMP-Error: Calling error for procedure 'gimp-image-set-active-layer':
Procedure 'gimp-image-set-active-layer' has been called with an invalid ID for argument 'active-layer'. Most likely a plug-in is trying to work on a layer that doesn't exist any longer.
batch command experienced an execution error:
Error: Procedure execution of gimp-image-set-active-layer failed on invalid input arguments: Procedure 'gimp-image-set-active-layer' has been called with an invalid ID for argument 'active-layer'. Most likely a plug-in is trying to work on a layer that doesn't exist any longer.
/home/cassou/.nix-profile/bin/gimp: GEGL-WARNING: (../gegl/buffer/gegl-tile-handler-cache.c:1076):gegl_tile_cache_destroy: runtime check failed: (g_queue_is_empty (&cache_queue))
EEEEeEeek! 2 GeglBuffers leaked
Am I doing something incorrect or is the plug-in buggy?
Update
If I add these statements to the script at the start of the let
body:
(print "=============================")
(print image)
(print drawable)
(print "=============================")
I get:
"============================="
1
2
"============================="
as output.