1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>9. Using Script-Fu Scripts</title>
<link rel="stylesheet" href="gimp-help-plain.css" type="text/css" />
<link rel="stylesheet" href="gimp-help-screen.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.66.1" />
<link rel="start" href="index.html" title=" " />
<link rel="up" href="ch02.html" title="Chapter 2. Using Gimp" />
<link rel="prev" href="ch02s08s04.html" title="8.4. Writing Plugins" />
<link rel="next" href="ch02s10.html" title="10. A Script-Fu Tutorial" />
</head>
<body>
<div xmlns="" class="navheader">
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center" id="chaptername">9. Using Script-Fu Scripts</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="ch02s08s04.html">Prev</a> </td>
<th width="60%" align="center" id="sectionname">9. Using Script-Fu Scripts</th>
<td width="20%" align="right"> <a accesskey="n" href="ch02s10.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a id="gimp-using-script-fu"></a>9. Using Script-Fu Scripts</h2>
</div>
</div>
</div>
<a id="id3315666" class="indexterm"></a>
<div class="simplesect" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="id3316113"></a>Script-Fu?</h3>
</div>
</div>
</div>
<p>
Script-Fu is what the Windows world would call "macros" 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 database. You can do all kinds of things
with Script-Fu, but an ordinary Gimp user will probably use it
for automating things that:
</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>
You want to do frequently.
</p>
</li>
<li>
<p>
Are really complicated to do, and hard to remember.
</p>
</li>
</ul>
</div>
<p>
Remember that you can do a whole lot with Script-Fu. The
scripts that come 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 the Script-Fu Tutorial in the next section
if you want to learn more about how to make scripts.
</p>
<p>
We will describe some of the most useful scripts in this
chapter, but we won't cover them all. There are simply too many
scripts. Some of the scripts are also very simple and you will
probably not need any documentation to be able to use them.
</p>
<p>
Script-Fu (a dialect of Scheme) isn't the only scripting
language available for Gimp. But Script-Fu is the only scripting
language that is installed by default. Other available scripting
extensions are Perl and Tcl. You can download and install both
extensions at the <a href="http://registry.gimp.org" target="_top">Gimp
Plugin Registry</a>.
</p>
</div>
<div class="simplesect" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="id3315738"></a>Installing Script-Fus</h3>
</div>
</div>
</div>
<p>
One of the great things about Script-Fu is that you can share your
script with all your Gimp friends. There are many scripts
that come with Gimp by default, but there are also vast
quantities of scripts that
are available for download all around the Internet.
</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25">
<img alt="[Tip]" src="../images/tip.png" />
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td colspan="2" align="left" valign="top">
<p>
If you have downloaded a script, copy or move your new script to
your <tt class="filename">.gimp-2.0/scripts</tt> directory and do 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.
</p>
</td>
</tr>
</table>
</div>
<p>
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.
</p>
</div>
<div class="simplesect" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="id3316033"></a>Do's and Don'ts</h3>
</div>
</div>
</div>
<p>
A common error when you are dealing with Script-Fus 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.
</p>
<p>
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 on your system. So
please check the information in the dialog before blaming the
script.
</p>
</div>
<div class="simplesect" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="id3316266"></a>Different Kinds Of Script-Fus</h3>
</div>
</div>
</div>
<p>
There are two kinds of Script-Fus -- standalone scripts and
image-dependent scripts. You will find the standalone variants
under
<span class="guimenu">Xtns</span>-><span class="guisubmenu">Script-Fu</span>-><span class="guimenuitem"><i class="replaceable"><tt>Type of Script</tt></i></span> in the main toolbox menu,
and the image-dependent scripts are placed under
<span class="guimenu">Script-Fu</span>-><span class="guimenuitem"><i class="replaceable"><tt>Type of Script</tt></i></span> in the image menu.
</p>
</div>
<div class="simplesect" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="id3316223"></a>Standalone Scripts</h3>
</div>
</div>
</div>
<p>
We will not try to describe every script in depth. Most
Script-Fus are very easy to understand and use. At the time of
this writing, the following types are installed by default:
</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>
Patterns
</p>
</li>
<li>
<p>
Web page themes
</p>
</li>
<li>
<p>
Logos
</p>
</li>
<li>
<p>
Buttons
</p>
</li>
<li>
<p>
Utils
</p>
</li>
<li>
<p>
Make Brush
</p>
</li>
<li>
<p>
Misc.
</p>
</li>
</ul>
</div>
<div class="variablelist">
<dl>
<dt>
<span class="term">Patterns</span>
</dt>
<dd>
<p>
You will find all kinds of pattern-generating scripts
here. Generally, they are quite useful because you can add many
arguments to your own patterns.
</p>
<p>
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.
</p>
</dd>
<dt>
<span class="term">Web Page Themes</span>
</dt>
<dd>
<p>
Here is clearly a practical use for scripts. By creating a
script for making 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, because you don't
have to create every logo, text or button by hand.
</p>
<p>
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 template that you can modify to
create a theme for your web site.
</p>
<p>
Most of the scripts are quite self-explanatory, but here are
some hints:
</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>
Leave all strange characters like ' and " intact.
</p>
</li>
<li>
<p>
Make sure that the pattern specified in the script exists.
</p>
</li>
<li>
<p>
Padding refers to the amount of space around your text.
</p>
</li>
<li>
<p>
A high value for bevel width gives the illusion of a higher button.
</p>
</li>
<li>
<p>
If you type TRUE for "Press", the button will look pushed down.
</p>
</li>
<li>
<p>
Choose transparency if you don't want a solid background. If
you choose a solid background, make sure it is the same
color as the web page background.
</p>
</li>
</ul>
</div>
</dd>
<dt>
<span class="term">Logos</span>
</dt>
<dd>
<p>
Here you will find all kinds of logo-generating scrips. This
is nice, but use it with care, as people might recognize your
logo as being made by a known Gimp script. You should rather
regard it as a base that you can modify to fit your needs. The
dialog for making a logo is more or less the same for all such
scripts:
</p>
<div class="orderedlist">
<ol type="1">
<li>
<p>
In the Text String field, type your logo name, like Frozenriver.
</p>
</li>
<li>
<p>
In the Font Size text field, type the size of your logo in pixels.
</p>
</li>
<li>
<p>
In the Font text field, type the name of the font that you
want to use for your logo.
</p>
</li>
<li>
<p>
To choose the color of your logo, just click on the color
button. This brings up a color dialog.
</p>
</li>
<li>
<p>
If you look at the current command field, you can watch the
script run.
</p>
</li>
</ol>
</div>
</dd>
<dt>
<span class="term">Make Buttons</span>
</dt>
<dd>
<p>
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 logo scripts. You can
experiment with different settings to come up with a button you
like.
</p>
</dd>
<dt>
<span class="term">Utils</span>
</dt>
<dd>
<p>
Under Utils you will find a small but nice script: 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.
</p>
<p>
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 palette.
</p>
</dd>
<dt>
<span class="term">Misc.</span>
</dt>
<dd>
<p>
Under Misc. you'll find scripts that 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.
</p>
</dd>
<dt>
<span class="term">Make Brush</span>
</dt>
<dd>
<p>
This script lets you make your own custom rectangular/circular
brushes, with or without feathered (blurred) edges. 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.
</p>
</dd>
</dl>
</div>
</div>
<div class="simplesect" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="id3316365"></a>Image-Dependent Scripts</h3>
</div>
</div>
</div>
<p>
These are scripts that perform operations on an existing
image. In many ways they are like the plug-ins in the Filters
menu. The following script groups are installed by default:
</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>
Decor
</p>
</li>
<li>
<p>
Modify
</p>
</li>
<li>
<p>
Animators
</p>
</li>
<li>
<p>
Stencil Ops
</p>
</li>
<li>
<p>
Alchemy
</p>
</li>
<li>
<p>
Shadow
</p>
</li>
<li>
<p>
Render
</p>
</li>
<li>
<p>
Utils
</p>
</li>
<li>
<p>
Selection
</p>
</li>
</ul>
</div>
<div class="variablelist">
<dl>
<dt>
<span class="term">Stencil Ops</span>
</dt>
<dd>
<p>
Here, you'll find two scripts: Carve-It and Chrome-It, which
can render some truly nice artistic effects on grayscale
images.
</p>
</dd>
<dt>
<span class="term">Drop Shadow</span>
</dt>
<dd>
<p>
Drop Shadow will cast a shadow behind your selected
object. It has three important parameters. X and Y offset
determine where the shadow will be placed in relation to the
selected object. Offset is measured in pixels. High values
make 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, because a shadow that is cast far from the object
has a higher blur level.
</p>
</dd>
<dt>
<span class="term">Perspective Shadow</span>
</dt>
<dd>
<p>
Perspective Shadow has a very important parameter: 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-explanatory. You'll get more blur if
the horizon is far away, and the shadow length is the length
in relation to the selected object.
</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="ch02s08s04.html">Prev</a> </td>
<td width="20%" align="center">
<a accesskey="u" href="ch02.html">Up</a>
</td>
<td width="40%" align="right"> <a accesskey="n" href="ch02s10.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">8.4. Writing Plugins </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> 10. A Script-Fu Tutorial</td>
</tr>
</table>
</div>
</body>
</html>
|