On Tue, Sep 20, 2005 at 11:03:55AM +0200, Martin Lesser wrote:
> Is it possible to create images with python-fu but without a GUI?
> 
> I tried
> 
> # PYTHONPATH=/usr/lib/gimp/2.0/python python
> from gimpfu import *
> img = gimp.Image(100, 100, RGB)
> 
> but this results in a glib-error:
> 
>   LibGimpBase-ERROR **: could not find handler for message: 5

As you found out, this won't work. Python-Fu scripts can only be invoked
from GIMP itself.

> How do I tell gimpfu to run in non-interactive mode from command-line or
> other scripts?

Write your script like any other python-fu script, and stick it in the
plug-ins directory:

    #!/usr/bin/env python

    from gimpfu import *

    def do_stuff():
        img = gimp.Image(100, 100, RGB)
        print img

    register(
        "python_fu_do_stuff",
        "Stuff",
        "Things!",
        "Me!",
        "Me!",
        "2005",
        "<Toolbox>/Xtns/Python-Fu/Do Stuff",
        "",
        [],
        [],
        do_stuff)

    main()

Then invoke from the command line:

$ gimp -i -b '(python-fu-do-stuff 1)' -b '(gimp-quit 0)'

This will create an image and print "<gimp.Image 'Untitled'>" to the
console if successful.

-Yosh
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.xcf.berkeley.edu
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-user

Reply via email to