Fluttering flag
A script-fu for The Gimp
Example
Description
"Fluttering flag" is a script-fu for the Gimp.
It animates an ordinary flat image of a flag by blowing wind onto the flag. More precisely, it creates a choosen number of layers that can be saved as an animated gif image. It is recommended to generate 8 layers and to use original images with a width under 200 pixels. The script will work with larger images too, but the produced gif animation will be a very big file, especially unsuitable to be published on the web.
The original image should be an RGB (24 bit depth), an RGBA (32 bit depth), a GRAY, GRAYA, INDEXED or INDEXEDA. That means that *.png files, *.gif or *.jpg files are usable.
Input parameters
- A low ripple parameter gives a quite waveless flag, a high ripple parameter gives a very wavy flag.
- The wind parameter (wind strength) affects the amplitude of the movement.
- The form factor can be a random number or a specific number. Some form factors produce better animations than others. Fine vertical dark lines may be created with some form factors, avoid them. Recommended values among others: 5, 14, 134, 199. If you do find a specially good form factor, please let me know.
Saving as a gif file
When saving the produced layers as a *.gif file, you will get 2 dialog boxes. In the 1st dialog box select:
- Save as Animation
In the 2nd dialog box select:
- Loop forever
- Delay between frames = 100 ms.
- Frame disposal = one frame per layer
Comments
This script aims to be more parameterizable and more aware of details than similar ones. Scripts using simple minimal algorithms will produce an animated flag looking like a flying carpet, moving in every part of its area, thus seeming to slide up and down on the mast. This script takes care of this and assures that the flag stays still near the mast.
The parameterizable wind strength is also a feature that many similar scripts do not implement.
The form factor may please you or may annoy you. In the second case, just stick to the default value of 5 and forget this parameter.
The script has been tested with The Gimp version 2.2.9 on Linux SuSE, with The Gimp version 2.2.10 on Windoze and with The Gimp version 2.2.13 on Linux Ubuntu.
The script version 1.20 has been tested with The Gimp version 2.4.0 on Linux Ubuntu 7.10 Gutsy Gibbon.
The script version 1.22 has been tested with The Gimp version 2.4.5 on Linux Ubuntu 8.04 Hardy Heron.
The script version 1.31 has been tested with The Gimp version 2.6.8 on Linux Ubuntu 10.04 Lucid Lynx.
Versions:
2006.08.15 :
Version 1.00
2007.09.16 :
Version 1.10
The mast thickness can be adjusted, the mast is now optional.
A smoothing of the hitch of the repetition of the images has been implemented.
2007.10.25 :
Version 1.20. The current version is 1.20 and has been adapted to The Gimp 2.4. It is now under the menu "Filters" and not anymore under the menu "script-Fu".
2008.04.05 :
Version 1.21. Using the script on indexed pictures without grey in their palette did not always produce correct results, bug corrected.
2008.11.29 :
Version 1.22. Improvement of the edges of the flag when the background is transparent. Thanks to Peter PKHG from NL for the suggestion and the code.
2012.01.12 :
Version 1.31. Any color can now be selected to represent the transparent zones. The height of the mast can be adjusted too.
Download:
No Download button, the Script-Fu fluttering-flag.scm is just below in the light blue field, ready to be copied and saved.
⇩ The Script is here ⇩
Click into the blue frame below where the script is listed.
Type
Control-A to select the complete text of the script.
Type
Control-C to copy the script to the clipboard.
Go to your text editor (gedit, Kate, Aedix, Notepad, etc) and type
Control-V to paste the script.
Save it as a file named
fluttering-flag.scm
Linux Ubuntu or other Gnome: use the text editor gEdit, Geany or Bluefish
Linux Kubuntu or other KDE: use the text editor Kate or Geany
Mac OS X: use the text editor Smultron
Windoze:
use the text editor Aedix (free), Geany or Notepad (but beware of the file extension .txt which is unwanted, the script file must have the extension .scm and not .scm.txt)
Other text editors are ok too, but word processors are not. Do not use LibreOffice, OpenOffice, Word or similar tools.
Installation:
Copy
fluttering-flag.scm into one of the directories registered in the Gimp preferences under Folders/Scripts.
Linux Ubuntu and many others:
/home/[username]/.gimp-2.n/scripts or
/usr/share/gimp/2.0/scripts
Linux SuSE:
/home/[username]/.gimp-2.n/scripts or
/opt/gnome/share/gimp/2.0/scripts
Windoze:
C:\.gimp-2.n\scripts or
C:\program-files\gimp2.n\share\gimp\scripts
Then go to the menu Filters and select
Filters / Script-Fu / Refresh Scripts (Gimp 2.6) or go to the menu Xtns and select
Xtns / Script-Fu / Refresh Scripts (Gimp 2.4). That's it.
The script can be called in the menu
Filters / Animation / Fluttering flag...
Tutorial
A
Tutorial to use the script 'Fluttering flag' is available.
Sponsorship
If you find the script 'Fluttering flag' useful and want to support the developer, you can
License
The
GNU general public license applies to the script-fu
fluttering-flag.scm above.