Home | Hardware | Internet News |Web Hosting |IT Management |Network Storage
LinuxPlanet
Search 
  Power Search | Tips 

 Front Door
 Discussion
 LinuxEngine
 Opinions
 Reports
 Reviews
 Tutorials
 News
 Technology Jobs

 Browse by subject.
Free Newsletter

Linux Planet
Linux Today
More Free Newsletters

Be a Commerce Partner


















internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Print this article
Email this article

   LinuxPlanet / Tutorials







Writing Plugins for GIMP in Python
Creating a Script

Akkana Peck
Wednesday, April 8, 2009 11:23:20 PM

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/pytest
or, if you prefer, use your file manager to make it executable. Now you have a runnable GIMP-Python script.

Next: Registering Your New Plugin »

Skip Ahead

1 Creating a Script
2 Registering Your New Plugin
3 Does it Register?





Linux is a trademark of Linus Torvalds.


internet.com home | search | help! | about us

Jupiter Online Media

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers