Writing Plugins for GIMP in Python
Creating a Script
Have you ever wished you could automate a few functions in GIMP? Today's article will show you how to use Python to write simple GIMP plug-ins.
If you have gimp installed via your Linux distro, GIMP-Python is probably already included. To make sure, look for a Filters->Python-Fu menu. If you built your own GIMP and don't have the Python-fu, it may be that you didn't have python-gtk2 or python-gtk2-dev installed when you built it. Install them and re-run configure and you should be able to rebuild gimp with Python support. (In Ubuntu, you should have Xtns -> Python Fu-- ed.)
GIMP-Python scripts live under your home directory, in .gimp-2.6/plug-ins/. If you're using a different GIMP version, like 2.4 or 2.7, change the name appropriately. So edit a file there -- for example, $HOME/.gimp-2.6/plug-ins/pytest -- and start with the following headers:
#!/usr/bin/env python from gimpfu import *The "shebang" line tells Linux this is a Python script, and the second line tells Python that you'll be using the "gimpfu" library.
One more step: your file needs to be executable. So run
chmod 755 $HOME/.gimp-2.6/plug-ins/pytestor, if you prefer, use your file manager to make it executable. Now you have a runnable GIMP-Python script.
- Skip Ahead
- 1. Creating a Script
- 2. Creating a Script
- 3. Creating a Script
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.