Creating a Fancy 3D-Effect GIMP Plugin in Python
Your Fresh New BlobiPy Plugin
Rounded 3D text
GIMP is great for adding text to images. You can pick a nice font and color, but it still looks flat
It looks a little better if you add a drop shadow,
but what if you want the letters to look more rounded and three-dimensional?
Here's a technique that gives a nice 3-D effect:
- Make a text layer in GIMP. The effect shows up best if you use a light color, like yellow, on a text layer that's on top of some other background like a pattern or photo.
- Use Layer->Transparency>Alpha to Selection to select just the text, nothing else.
- Invert the selection with Select->Invert
- Bring up Filters->Light and Shadow->Drop Shadow...
- Pick some appropriate values for offset and radius, and make the offsets negative: for my sample I used -3 and 7.
- Un-check the Allow resizing box, and click OK.
- Select->None to get rid of the selection outline.
It makes a nice 3-D effect.
But it's a lot of steps. Who wants to do that every time? Let's make a Python script to do it.
The first step is to pick a name for your script. I called this technique "blobify" when I wrote it in script-fu, since it makes the letters look blobby. I showed it in a talk on GIMP scripting, and when I got to the Python section of the talk, a clever audience member suggested that the Python version should be "blobi-PY". And so it should!
So the create a file called $HOME/.gimp-2.6/plug-ins/blobipy and make it executable, as in the previous article.
The blobipy script will need at least a register function and a function that will do the real work. Start with something like this:
from gimpfu import *
def python_blobify(img, layer, blur) :
# do the real work here
"Create a 3-D effect",
"Create a blobby 3-D effect using inverse drop-shadow",
(PF_IMAGE, "image", "Input image", None),
(PF_DRAWABLE, "drawable", "Input layer", None),
(PF_SPINNER, "blur", "Blur amount",
7, (0, 50, 1))
menu="/Filters/Light and Shadow")
In the register function, I've specified three parameters for the script: a current image and a current layer -- "drawable" is just another name for "layer" -- and how much to blur. The python_blobify function takes three arguments corresponding to these three parameters.
The image and layer will be passed in automatically; the blur amount will be chosen by the user from a dialog that looks like Figure 4.
PF_SPINNER is a way of specifying a numeric amount: the default value is 7, but it can adjust from 0 to 50 by increments of 1 at a time.
Save the file and restart gimp. The script should show up in the Image window menus as Image->Filters->Light and Shadow->BlobyPy.
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: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Debian Gives Up on Upstart, Ubuntu and Linux Kernel Updates