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.
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.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: RHEL 6.5, Debian 7.2 and EOL for Linux 3.0.x
- 5Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10