Previous Next TOC Index Feedback

GUM v.1.0.0


37 

Script-Fu; description and function

In this chapter will we take a look at what's under the Xtns/Script-Fu menu in the Toolbox and in the Script-Fu menu in the image menu.

Script Fu?

Script Fu is what the Windoze world would call a "macro". But Script Fu is more powerful than that. Script Fu is based on an interpreting language called scheme, and works by using querying functions to the Gimp "data base". You can do all kinds of things with Script Fu, but an ordinary Gimp user will probably use it for automating things that:

Remember that you can do a whole lot with a script fu. The scripts that comes with Gimp can be quite useful, but they can also serve as models for learning script fu, or at least as a framework and source of modification when you make your own script. Read Chapter 38 and 39 if you want to learn how to make scripts.

Installing Script-Fu:s

The great thing about Script-Fu:s is that you can share your script with all your Gimp friends. There are several scripts that come with Gimp by default, but there are also scripts that are available for download all around the Internet.

If you have downloaded a script, copy or move your new script to your .gimp/scripts directory and make a refresh.

The script will now appear in one of your menus. If you don't find it, look for it under the root file menu filters. If it doesn't appear at all, something was wrong with the script.

Note that you can't use more than one script-fu dialog at a time. So don't open a script and one more after that. The last one will never be opened and displayed.

Don't and Do:s

A common error when you are dealing with script Fu:s is that you simply bring them up and press the OK button. When nothing happens, you probably think that the script is broken or buggy, but there is most likely nothing wrong with it. Think again. Did you really read the information in the dialog, or did you just press the button? If you forgot an input the script needs, or if you gave it the wrong input, the script will fail. One of the most common errors is that the font specified in the script dialog hasn't been installed in your system. So please, check the information in the dialog before blaming the script.

Different kinds of Script Fu:s

There are two kinds of Script Fu:s - stand alone scripts and image dependent scripts. You will find the stand alone variants under Xtns/Script Fu/Type of Script, and the Image dependent scripts are placed under <image>/Script Fu/Type of Script.

Stand alone scripts

We will not try to describe every script in depth, as we did with the filters. Most Script Fu:s are very easy to understand and use. At the time of this writing, the following types are installed by default.

Patterns

You will obviously find all kinds of pattern generating scripts here. Generally, they are quite useful since you can add many arguments to your own patterns.

.
Extracted pic [1] We'll take a look at the Land script. In this script you have to set the image/pattern size, and specify what levels of random to use for your land creation. The colors used to generate the land map are taken from the currently selected gradient in the gradient editor. You must also supply values for the level of detail, land and sea height/depth, and the scale. Scale refers to the scale of your map, just as in an ordinary road map. 1:10 will be typed as 10.

Web page themes

Here is clearly a practical use for scripts. By creating a script for making your custom text, logos, buttons arrows etc. for your web site, you will give them all the same style and shape.You will also be saving a lot of time, since you don't have to create every logo, text or button by hand. You will find the Gimp.org theme under the Web page theme submenu. If you want to create your own theme, this script will serve as an excellent start to modify (remember to share your modified script's with the rest of the Gimp community).
Extracted pic [2]

The scripts are quite self-explaining but here are some hints:

Logos

Here will you find all kinds of logo-generating scrips. This is nice, but use it with care as people might recognize your logo as made by a known Gimp script. You should rather regard it as a base that you can modify to fit your purpose. The dialog for making a logo is more or less the same:

Make Buttons


Extracted pic [4] Under this headline you'll find a script that makes beveled buttons. The script has a dozen parameters or so, and most of them are similar to those in the previous scripts. You have to experiment with different settings to come up with a button you like.

Utils

Under Utils will you find small but nice script. We'll take a look at the Fontmap script, which makes an image of your fonts. You will have to type the names of the fonts you want displayed in the "Fonts" text field. A tip is to use xfontsel to see what fonts are installed. The Custom gradient script creates an image of the current custom gradient in the gradient editor. This can be useful if you want to pick colors from a gradient as in a a palette.
Extracted pic [5]

Misc.


Extracted pic [6] Under Misc. you'll find scripts which can be quite useful, but aren't suitable for the other submenus. An example is the Sphere script. You will have to set the radius in pixels to determine the sphere size. The lighting angle is where at the sphere you point the spotlight. This value also has an impact on the sphere shadow. If you don't want a shadow, you will have to type FALSE. The last thing you have to select is background color, and the color of your sphere
Extracted pic [7]

Make Brush

Brushes lets you make your own custom rectangular/circular brushes, with or without feathered (blurred) edges. To ensure full control over the parameters you will have to look in chapter 11. The script will automatically store your brush in your personal brush directory. You just have to press refresh in the brush selection dialog to use your newly created brush.

Image dependent scripts

The image dependent script are scripts that will do certain things to an already existing image. These scripts are more like the plug-ins in the filters submenu. At the time of this writing, the following script groups are installed by default.

Decor

Scripts that add different kinds of borders to an existing image or selection.
Extracted pic [8]

As you see in this example, you must take care to be a bit more exact than usual with scripts than with filters. Our Malibu was sadly chopped in both the front and the rear. The other script was a lot kinder when adding a nice border shadow to our Malibu image.

Modify

Here will you find the add border script, which is nearly perfect if you want to make a passe-partout, or simply add a beveled border.
Extracted pic [9]

Animators

These scrips will do all kinds of automated animations. Try for example the Waves script, which creates a pond ripple effect.

Stencil Ops

Here you'll find two scripts: "Carve it" and "Chrome it", which can create some truly nice artistic effects on grayscale images.
Extracted pic [10]

Alchemy

This is the script equivalent to the artistic filters and enhance filters in the filters submenu.
Extracted pic [11]

Unsharp Mask

One of the most useful Script Fu's is Unsharp Mask which sharpens an image. Unsharp Mask is often a better alternative than sharpen. Sharpen will accentuate all of your image, including scratches, noise and other imperfections that you don't want in your image. Unsharp Mask works by increasing the contrast of edges and nearby pixels, while other areas are left pretty much untouched. This makes Unsharp mask ideal for enhancing scanned images. The mask value is the amount of sharpening you want, or more accurately; how wide the edge areas should be.
Extracted pic [12]

If you apply image effect functions like Scale, Rotate, Perspective etc. try using Unsharp mask afterwards, since those type of filters use interpolation and thereby softens or blurs your image. If you just want to enhance a small part of your image, then ordinary sharpen is an adequate tool (you can't use Unsharp Mask on selections).

Tips

It's a good idea to run Unsharp mask twice with half the mask value instead of just once with the whole value. This will sharpen more smoothly (don't forget to flatten the image).

Shadow

Here are two really useful scripts that you will probably use quite frequently. These scrips are called Drop Shadow and Perspective Shadow.

Drop Shadow

Drop Shadow will cast a shadow behind your selected object. It has three important parameters; X and Y offset which is where the shadow will be placed in relation to the selected object, and it's measured in pixels. High values makes the shadow look like it's far away, and low values will make it look closer to the object. The blur value is also important since a shadow that is cast far from the object has a higher blur level.
Extracted pic [13]

Perspective Shadow


Extracted pic [14] Perspective Shadow has a very important parameter; and that is the perspective angle. if this angle is set to 0 or 180 there will be no shadow, because the script assumes that the object has no thickness. This also means that this script looks fine in certain angles, but unnatural in others. The other parameters are quite self-describing. You'll get more blur if the horizon is far away, and the shadow length is the length in relation to the selected object.

Render

Rendering scripts are not very different from what you find in the filter menu
Extracted pic [15]

Utils

Here are two scripts that display image structure, the example below shows the HSV curve of the Malibu image.
Extracted pic [16]

Selection

These scripts can be applied on your current selection. There isn't much to say, they are quit-self explaining.


Generated by fmtoweb (v. 2.9c) written by Peter G. Martin <peterm@zeta.org.au> Last modified: 20 May 1998

Previous Next TOC Index Feedback