As I mentioned in my last post “Developing Gimp plugins using Python”, I was trying to create a typed text animation using Gimp, which should be integrated into a screencast intro I am currently working on. One problem I had to face was the renaming of the image layers, that allows me to control the frame rate and overlay behavior.
Because I had to handle so many layers, I wrote a simple script that renames all layers. After starting the script a dialog asks for the layer’s base name and the amount of milliseconds a layer should be displayed. After confirming the input by selecting “OK” the script renames all layers so each layer name had the following format:
If you now view the animation using the build in Gimp previewer (Filter -> Animation -> Playback), each layer is displayed m milliseconds and is then replaced by the next one.
Even though this worked pretty well, I still had to create all this layers by hand, merge each of them with the background image and add the text layer by layer. That sucks! So I decided to write a more advanced plugin that utilizes all the power of Gimp’s Python scripting engine, so I could create a new typed text animation by just entering a few input parameters.
Once I found the correct command and the correct parameters for this command, it was pretty simple to extend my implementation to use this new operation, but since there is no offical manual that is up to date (just found the Gimp Python Documentation), this all took a long time. Finally the script ended being quite simple and elegant (see the code below).
Hope this either helps you to understand how writing python extentions for Gimp works or the script itself is useful for for you. I would also be happy to see some of your own scripts.
So stay tuned and until next time - happy coding!
Phidelux is a Computer Science MSc. interested in hardware hacking, embedded Linux, compilers, etc.