Question

I want to make a script-fu script that takes two images as input. How do I do this? Is there a file selector type?

From the tutorial I know that I can do something like

  (script-fu-register
            "script-fu-text-box"                        ;func name
            "Text Box"                                  ;menu label
            "Creates a simple text box, sized to fit\
              around the user's choice of text,\
              font, font size, and color."              ;description
            "Michael Terry"                             ;author
            "copyright 1997, Michael Terry;\
              2009, the GIMP Documentation Team"        ;copyright notice
            "October 27, 1997"                          ;date created
            ""                     ;image type that the script works on
            SF-STRING      "Text"          "Text Box"   ;a string variable
            SF-FONT        "Font"          "Charter"    ;a font variable
            SF-ADJUSTMENT  "Font size"     '(50 1 1000 1 10 0 1)
                                                        ;a spin-button
            SF-COLOR       "Color"         '(0 0 0)     ;color variable
            SF-ADJUSTMENT  "Buffer amount" '(35 0 100 1 10 1 0)
                                                        ;a slider
  )
  (script-fu-menu-register "script-fu-text-box" "<Image>/File/Create/Text")
  (define (script-fu-text-box inText font fontSize textColor bufferAmount)

And this mentions that if you want it to operate on an open image this should be the first parameter, but what if I want it to operate on two images and join them into one (as layers, but then with some transforms applied)?

Was it helpful?

Solution

Just use the SF-IMAGE parameter type. Once for each image you want as input.

For the script-fu to operate on the active image, the first two parameters should be SF-IMAGE followed by SF-DRAWABLE, and the script has to be registered to the "" menu.

Add a second SF-IMAGE parameter as third parameter, bellow the SF-IMAGE and chec what you get back.

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