Re: [Gimp-user] script-fu-register -- SF-IMAGE -- what do the parameters mean?



On Sat, Aug 19, 2017 at 09:50:04PM +0200, TimHelck wrote:
I have a script-fu script that does some processing to an image and then saves
it with a new name provided by the user. The process is in the "Image" menu. It
works on whichever image is open and selected. I can open more images and the
script works on the new ones. However, if I close one of the images opend
earlier, the script causes this error:


Only just got this mail today - posts via that website are always
delayed, but I thinmk a week is a new record.  Anyway :

Error: ( : 2) Procedure execution of gimp-image-get-filename failed on invalid
input arguments: Procedure 'gimp-image-get-filename' has been called with an
invalid ID for argument 'image'. Most likely a plug-in is trying to work on an
image that doesn't exist any longer.

Once this error occurs I have to exit GIMP and start up fresh.

Is there a way to overcome this?


When you have problems in Script-Fu, go to the Script-Fu Console via
Filters -> Script-Fu -> Console
and from the Console click on Browse - that will open up the
Procedure Browser where you can search for the procedure.

In this case, I think the error message indicates that the image has
not been passed to the procedure.

I have tried playing with the values on the SF-IMAGE line. Changing them seems
to make no difference to the behavior. What are these parameters supposed to do?

here is my script-fu-register call:

(script-fu-register 
  "script-fu-process-sketch"
  "Process Sketch"
  "Save all opened images"
  "Tim Helck"
  "Tim Helck"
  "08/13/2017"
  ""
  SF-IMAGE  "Image"        -1  
                             ^^

I've only ever written one plugin, for mine the corresponding line
is
  SF-IMAGE       "Current image" 0

So I would try changing your value from -1 to 0.

You can then refresh the filters via the Script-Fu menu.
 
  SF-STRING "New Name"     ""   ;a string variable
)

(script-fu-menu-register "script-fu-process-sketch" "<Image>/Image/Process
Sketch")

Also -- I am wondering, what difference, if any, does it make if I put this
script in a different menu?

The only likely change is that you'll have to use the different menu
to access the script.

Other Info:
Macbook 10.9.5 (Maverick)
GIMP 2.8.14

ĸen
-- 
Truth, in front of her huge walk-in wardrobe, selected black leather
boots with stiletto heels for such a barefaced truth.
                                     - Unseen Academicals


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]