RSS/Atom feed Twitter
Site is read-only, email is disabled

Howto create images with gimp-python non-interactive

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

5 of 5 messages available
Toggle history

Please log in to manage your subscriptions.

Howto create images with gimp-python non-interactive Martin Lesser 20 Sep 11:03
  Howto create images with gimp-python non-interactive Roman Joost 20 Sep 12:53
   Howto create images with gimp-python non-interactive Martin Lesser 20 Sep 15:28
    Howto create images with gimp-python non-interactive Carol Spears 20 Sep 18:02
  Howto create images with gimp-python non-interactive Manish Singh 22 Sep 01:41
Martin Lesser
2005-09-20 11:03:55 UTC (over 18 years ago)

Howto create images with gimp-python non-interactive

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

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

TIA, Martin

Roman Joost
2005-09-20 12:53:28 UTC (over 18 years ago)

Howto create images with gimp-python non-interactive

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

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

I'm not sure what you're trying to achieve with GIMP, but maybe you want to use PIL?

http://www.pythonware.com/products/pil/

Greetings,

Martin Lesser
2005-09-20 15:28:02 UTC (over 18 years ago)

Howto create images with gimp-python non-interactive

Roman Joost writes:

On Tue, Sep 20, 2005 at 11:03:55AM +0200, Martin Lesser wrote:

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

I'm not sure what you're trying to achieve with GIMP, but maybe you want to use PIL?

PIL does not offer all functions I need. Saving animated gifs with many frames is also not optimal with the PIL-encoder cause each frame has to have the same size.

So the idea is to access gimp-plugins from within python-scripts and finally create dynamicly generated animated gif-files.

Greetings

Martin

Carol Spears
2005-09-20 18:02:57 UTC (over 18 years ago)

Howto create images with gimp-python non-interactive

On Tue, Sep 20, 2005 at 03:28:02PM +0200, Martin Lesser wrote:

Roman Joost writes:

On Tue, Sep 20, 2005 at 11:03:55AM +0200, Martin Lesser wrote:

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

I'm not sure what you're trying to achieve with GIMP, but maybe you want to use PIL?

PIL does not offer all functions I need. Saving animated gifs with many frames is also not optimal with the PIL-encoder cause each frame has to have the same size.

So the idea is to access gimp-plugins from within python-scripts and finally create dynamicly generated animated gif-files.

my goal is to use gimp non-interactively like that on a script i am writing. i was going to use gimp-console.

i think the quickest way to see if your gimp was built with this option is to type "man gimp-console". if your gimp was built with this option then typing that should show if it is present and also give instructions on how to use it.

if it is not there, it is a simple configuration option.

hmm, now i have a question. i wonder if you have built gimp in the past with this option but the recent gimp build doesn't have it, if the old one will still exist on my computer.....

since there have been no complaints about it i have heard of, you might be a good debugger for it.

carol

Manish Singh
2005-09-22 01:41:12 UTC (over 18 years ago)

Howto create images with gimp-python non-interactive

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",
"/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 "" to the console if successful.

-Yosh