Previous | Next

Create the text layer

#!/usr/bin/env python

from gimpfu import *

def hello_world(initstr, font, size, color) :
    img = gimp.Image(1, 1, RGB)

    gimp.set_foreground(color)

    layer = pdb.gimp_text_fontname(img, None, 0, 0,
                                   initstr, 10, True,
                                   size, PIXELS, font)

    img.resize(layer.width, layer.height, 0, 0)

    gimp.Display(img)
Create a new text layer, with the string, font, and size chosen by the user.

This looks a little complicated. What are all the arguments, and why does it have a silly name like pdb dot gimp_text_fontname?

Don't worry -- I'll explain a little later how to find out details like that.