Question

I'm experimenting with script-fu, trying to teach myself how to use it. I have the following basic script, which I thought would create, then display, a new image:

(define (script-fu-test)
  (let*
      (
       (image (car (gimp-image-new 10 10 RGB)))
       )
    (gimp-display-new image)
    (gimp-context-pop)
    )
  )

I'm calling the script like so:

./gimp-2.8 -i -b '(script-fu-test)'

and it's failing, like so:

batch command experienced an execution error:
Error: ( : 32662) Procedure execution of gimp-display-new failed 

anyone have a hint about what i might be messing up here?


I'm running this on a Mac OS X (ie /Applications/Gimp.app/Contents/MacOS/gimp-2.8)

Was it helpful?

Solution

When I try to use a simplified version of your code, I get the following results:

$ gimp -b '(gimp-display-new (car (gimp-image-new 10 10 RGB)))'
batch command executed successfully

$ gimp -i -b '(gimp-display-new (car (gimp-image-new 10 10 RGB)))'
batch command experienced an execution error

Note that in the first case there's no -i, so the user interface is a available. In the second case, there's a -i, so there's no user interface. You can't use gimp-display-new without an interface. That you can't use gimp-display-new in no-interface mode is also mentioned in:

  • RE: Script can't connect to Perl Server on the gimp-perl mailing list

    Make sure you start up gimp in batch mode with this line:

    gimp --no-interface --batch '(extension-perl-server 1 0 0)' &
    

    But it also means you can't do gimp-display-new, which is extremely useful for debugging. I use interactive gimp when writing new image generation code, and then --no-interface during production.

  • The "Linux LaTeX-PDF HOW-TO" by Udo Schuermann, which says:

    Note, the "1" as the first argument in the commands refers to the fact that this script is to run in non-interactive mode. I've commented out the (gimp-display-new img) command; if you ran this in interactive mode it would not just prompt you for various parameters but would also produce an image window to show you the result. But we definitely do not want to bother with visible stuff and interactive operations in this project. Onwards we go:"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top