Ask all general Gimp related questions here
Post a reply

error adding new script to gimp

Sun May 05, 2024 10:03 am

GIMP Version: 2.8.14
Operating System: Linux
GIMP Experience: Intermediate Level

List any relevant plug-ins or scripts:
(define (script-fu-abrir-imagen ruta-imagen)
(let*
(
(imagen (car (gimp-file-load RUN-NONINTERACTIVE ruta-imagen "/home/wel/Documentos/image/image/logo1.png")))
(lienzo-activo (car (gimp-image-get-active-layer imagen)))
)
(gimp-image-insert-layer imagen lienzo-activo -1 0)
(gimp-displays-flush)
)
)

(script-fu-register "script-fu-abrir-imagen"
"<Toolbox>/Archivo/Abrir imagen"
"Abre una imagen específica como nueva capa"
"Pepe"
"Pepe"
"2023"
"*"
SF-FILENAME "Ruta de la imagen" "/home/wel/Documentos/image/image/logo1.png"
)


List any ERROR messages you received:
Error while executing script-fu-image-open-image:

Error: Procedure execution of gimp-image-insert-layer failed on invalid input arguments: The element "Background" (4) has already been added to an image.

Unable to run GimpPdbProgress callback. The corresponding plugin must have failed.




I tried to create a script in which only by pressing a key combination I could paste a previously selected image as if it were a layer on top of another image.

Re: error adding new script to gimp

Sun May 05, 2024 12:28 pm

now I get this error Error loading /usr/share/gimp/2.0/scripts/image.scm:

(define (script-fu-abrir-imagen /home/wel/Imágenes/Photo/SCAN HADA/logo1.png)
(let*
(
(imagen-existente (car (gimp-image-list)))
(imagen-nueva (car (gimp-file-load RUN-NONINTERACTIVE ruta-imagen /home/wel/Imágenes/Photo/SCAN HADA/logo1.png)))
(fondo-layer (car (gimp-image-get-layer-by-name imagen-existente "Fondo")))
)
(if (not fondo-layer)
(begin
(let*
(
(nueva-capa (car (gimp-image-merge-visible-layers imagen-existente EXPAND-AS-NECESSARY)))
)
(gimp-image-insert-layer imagen-existente nueva-capa -1 -1)
(gimp-displays-flush)
)
)
(begin
(let*
(
(nueva-capa (car (gimp-layer-new imagen-existente
(car (gimp-image-width imagen-nueva))
(car (gimp-image-height imagen-nueva))
"Nueva capa" RGB-IMAGE 100 NORMAL-MODE)))
)
(gimp-image-insert-layer imagen-existente nueva-capa -1 -1)
(gimp-displays-flush)
)
)
)
)

(script-fu-register "script-fu-abrir-imagen"
"<Toolbox>/Archivo/Abrir imagen"
"Abre una imagen específica como nueva capa"
"Pepe"
"Pepe"
"2023"
"*"
SF-FILENAME "Ruta de la imagen" "/home/wel/Imágenes/Photo/SCAN HADA/logo1.png"
)

Re: error adding new script to gimp

Sun May 05, 2024 12:32 pm

I also have this one that does not do anything after running it

(define (script-fu-abrir-imagen ruta-imagen)
(let*
(
(imagen (car (gimp-file-load RUN-NONINTERACTIVE ruta-imagen "/home/wel/Imágenes/Photo/SCAN HADA/logo1.png")))
(fondo-layer (car (gimp-image-get-layer-by-name imagen "Fondo")))
)
(if (not fondo-layer)
(begin
(let*
(
(nueva-capa (car (gimp-image-merge-visible-layers imagen EXPAND-AS-NECESSARY)))
)
(gimp-image-insert-layer imagen nueva-capa -1 -1)
(gimp-displays-flush)
))
)
)
)

(script-fu-register "script-fu-abrir-imagen"
"<Toolbox>/Archivo/Abrir imagen"
"Abre una imagen específica como nueva capa"
"Pepe"
"Pepe"
"2023"
"*"
SF-FILENAME "Ruta de la imagen" "/home/wel/Imágenes/Photo/SCAN HADA/logo1.png"
)

Re: error adding new script to gimp

Sun May 05, 2024 6:41 pm

I tried to create a script in which only by pressing a key combination I could paste a previously selected image as if it were a layer on top of another image.


You don't need a script. Ctrl-C on the second image. On the first image > Edit > Paste as > new layer.

BTW welcome to the forum.
Post a reply