RSS/Atom feed Twitter
Site is read-only, email is disabled

script-fu-register -- SF-IMAGE -- what do the parameters mean?

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

script-fu-register -- SF-IMAGE -- what do the parameters mean? TimHelck 19 Aug 19:50
  script-fu-register -- SF-IMAGE -- what do the parameters mean? Ken Moffat via gimp-user-list 26 Aug 16:15
   script-fu-register -- SF-IMAGE -- what do the parameters mean? TimHelck 04 Sep 20:29
2017-08-19 19:50:03 UTC (over 6 years ago)
postings
2

script-fu-register -- SF-IMAGE -- what do the parameters mean?

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:

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?

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
SF-STRING "New Name" "" ;a string variable )

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

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

Other Info: Macbook 10.9.5 (Maverick)
GIMP 2.8.14

Ken Moffat via gimp-user-list
2017-08-26 16:15:09 UTC (over 6 years ago)

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/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
2017-09-04 20:29:08 UTC (over 6 years ago)
postings
2

script-fu-register -- SF-IMAGE -- what do the parameters mean?

Ken,

Thanks for your response. As you suggest, I've played with different values for the 2nd parameter with no change in the behavior. I suspect that for the SF-IMAGE parameter type, the 2nd parameter is meaningless, even though it is required.

BTW -- I thought I had posted a reply last week after initially reading your response. Sorry to be late in acknowledging your help!

Regards,

Tim