- What is the best way to learn how to write Script-Fu scripts?
Familiarity with the Scheme language will be a big help. Whether you already
know Scheme or not you should get a copy of the
R5RS
(Scheme standards document) and read it. The Scheme interpreter in Script-Fu
attempts to follow the Scheme standard. Just keep it in mind that not
everything in the R5RS is implemented in the Scheme interpreter used in the
Script-Fu plug-in. Features of Scheme which are not supported include any
procedures with "syntax" in the name, bignums, and complex numbers.
I believe one of the problems people have when learning Scheme is that most
scripts are shown with multiple closing ) symbols at the end of a line. While
you are getting comfortable with Scheme I would suggest you don't skimp on the
whitespace. Put the closing parentheses on separate lines. It may violate some
Scheme-based coding style guides but it is much easier to see the syntax of
the language. It also makes it easier to find errors in your scripts.
There are
tutorials on the GIMP web site
under "Script Authoring" and I have
some notes about Script-Fu
in the wiki section of this web site. Don't forget that you have about 100
you can look at that are shipped with GIMP.
Be careful of any Script-Fu tutorial which was written before October 24, 2007
(the release date of the 2.4 version of GIMP). Tutorials written before that
date may contain information that is out-of-date, or even wrong, as GIMP
moved to a different Scheme interpreter with the 2.4 release.
- What is Tiny-Fu?
Tiny-Fu is a plug-in for the 2.2 series of GIMP. With it you can run scripts
(written in Scheme) to automate the operation of GIMP. It is essentially a
modified version of the Script-Fu plug-in but with some major changes.
Installing Tiny-Fu does not remove the Script-Fu plug-in. The code from this
project was rolled in to the Script-Fu plug-in of GIMP in October, 2006. If
you are running GIMP 2.4 then you are, in effect, using Tiny-Fu.
- What are the differences between Tiny-Fu and Script-Fu?
The main difference between Tiny-Fu and the Script-Fu plug-in of GIMP (before
the release of GIMP 2.4) is the use of TinyScheme as the Scheme interpreter
instead of the much older, and non-standards compliant, SIOD interpreter.
- What are the advantages of Tiny-Fu over Script-Fu?
There are several advantages to Tiny-Fu worth noting. I will point out three
of the most important ones.
First, the Scheme interpreter used in Tiny-Fu is a more recent generation
interpreter which attempts to follow the Scheme standards as closely as
possible unlike the over 9 year-old SIOD interpreter used in Script-Fu.
This makes it easier for someone who knows Scheme to more quickly begin
writing scripts for GIMP using Tiny-Fu. It is also re-entrant which should
allow later versions of GIMP to run more than one script at a time.
Second, Tiny-Fu includes a couple of extensions to the Scheme interpreter
it uses. The extensions add some time/date and file I/O functions to the
list of functions which can be used in scripts. The additions make the
creation of some scripts possible which would not have been possible in
Script-Fu. One such script (included with Tiny-Fu) is a contact sheet
generation script.
Third, debugging of scripts is much easier in Tiny-Fu. Tracing of script
execution can be turned on and off at any (almost) point in a script. When
tracing is turned on you will get very detailed information about the
execution of the script. Just be careful that you aren't affecting the
return value from a routine when you turn off tracing.
- Will I still be able to use Script-Fu after I install Tiny-Fu?
Yes, you will. Installing Tiny-Fu does not remove the Script-Fu plug-in.
The two plug-ins will happily co-exist. Be aware, however, that this may
change in a future release of Tiny-Fu due to changes to the GIMP source
tree currently being discussed.
- Which version of Tiny-Fu do I need for my copy of GIMP x.y?
If you are using GIMP 2.2, you should be using version 1.0.2 of Tiny-Fu.
If you are using GIMP 2.4, you do not need Tiny-Fu. The Tiny-Fu code was
rolled in to the Script-Fu plug-in of version GIMP 2.4. If you are using
the 2.5, or greater, version of GIMP you will need to wait a while as no
working version of Tiny-Fu exists for that GIMP release as of November 5,
2007.
- How can I obtain a copy of Tiny-Fu?
See the section on the main page titled
Downloading Tiny-Fu for information on
how to obtain source code and pre-compiled binary versions of Tiny-Fu.
- Where can I download a pre-compiled binary of Tiny-Fu?
The only pre-compiled binary of Tiny-Fu currently available for download is
an installer for Windows. See the section titled
Downloading Tiny-Fu for the link to
the executable file.
- Which Scheme interpreter is used in Tiny-Fu?
Tiny-Fu uses the interpreter created by Dimitrios Souflis known as TinyScheme.
- Why doesn't GIMP use Guile (or some other Scheme interpreter)?
The use of Guile has been proposed off and on as far back as 1998. Some of the
reasons against its use were it adds a rather big dependency, its startup time,
and people thought that GIMP should come with at least one script interpreter
on it's own.
One developer summarized the issue like this:
I'm now quite convinced that Guile is not a very good solution for
anything. There are far better full-fledged Scheme implementations
around (eg. PLT scheme), and also much neater tiny embeddable ones
(eg. TinyScheme). Guile is just a big mess.
- Where can I get more information about the TinyScheme interpreter?
http://tinyscheme.sourceforge.net/download.html
http://www.alphageeksinc.com/tinyscheme/doc/index.html
- Where can I get more information about the Scheme language?
The main document which defines the current version of the Scheme language is
titled "Revised5 Report on the Algorithmic Language Scheme" or
R5RS for short. A copy of this document in various formats can be found at
http://www.schemers.org/Documents/Standards/R5RS/.
- Will Tiny-Fu run scripts created for Script-Fu?
http://www.gimp.org/docs/script-fu-update.html
- What do I need to change in a Script-Fu script so it will run under
Tiny-Fu?
Some basic information about updating a Script-Fu script
for use with Tiny-Fu is listed on the main Tiny-Fu page in the section titled
Updating scripts.
More script updating information
can be found in my wiki.
- How do I turn on tracing of script execution?
You can turn on tracing of script execution by the use of the Scheme statement
(tracing 1). To turn off tracing, use
(tracing 0).
You need to be aware of two things regarding the use of the tracing feature.
First, it can generate a *LOT* of output and slow down script execution
(depending on where you enable/disable tracing). Second, these statements can
change the value returned from a routine if you use them in the wrong place.
- How do I use parasites in a script?