Great news, Chris!
The following is a basic introduction to Script-Fu.
You may wish to read it to tweak the Rob's script for your application
but not immediately.
Learning basic string operations on the pathClose Gimp. Reopen Gimp then open a picture.
The file extension does not matter.
In this example, "File" > "Open" iconAlSchemist.png
Open the Script-Fu console by the following menu:
"
Filters" > "
Script-Fu" > "
Console"
In the rectangular input box above the "Help" button and at the left of the "Browse" button, copy and paste:
Press ENTER to validate the call of the function.
Gimp will reply:
("2.10.34")The answer is displayed as a list containing only one element: the version number as a string.
Let us display the list of loaded images:
(1 #(1))
There is one picture in the editor. Its id is 1 if you have previously closed Gimp then reopened Gimp
Otherwise the id could be incremented.
To remember the id of the image, let us define the variable
img used as parameter in the Rob's functions.
Script-Fu replies with the name of the define, that is to say
img.
What is the value of img?
1
What is the full path of the current image?
save-and-export uses the Gimp API
gimp-image-get-filename:
(gimp-image-get-filename img)
("C:\\Tool\\Gimp\\forum\\GimpChat\\iconAlSchemist.png")
We are in Windows because of the double backslash.
Gimp always returns a list.
To get the first element of the list that is to say the string of the path, call the
car function.
(car (gimp-image-get-filename img))
"C:\\Tool\\Gimp\\forum\\GimpChat\\iconAlSchemist.png"
Let us save this fullname:
(define fullname (car (gimp-image-get-filename img)))
fullname
If you get the error
#<EOF>, verify the number of closing parenthesis.
"C:\\Tool\\Gimp\\forum\\GimpChat\\iconAlSchemist.png"
Copy in the clipboard by Ctrl+C the name of the function gimp-image-get-filename
Click the Browse button in the Script-Fu console.
Then paste the name of the function in the dialog box Script-Fu Procedure Browser.
Gimp will display the help of this function.
Note that there is only one parameter called
image.
We defined this parameter with the shorter name "
img" as in Rob's script.