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

GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui

This discussion is connected to the gimp-developer-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.

7 of 9 messages available
Toggle history

Please log in to manage your subscriptions.

GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui Michael Schroeder 17 Jul 13:18
  GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui Akkana Peck 20 Jul 17:22
   CAFjkzc2iLR88zPsuodcvgJoKjQ... 21 Jul 10:22
    CAH0mxTR23w9qqoXXrA=kobmFga... 21 Jul 10:22
     GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui Jon Nordby 21 Jul 10:11
   GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui Bertrand Denoix 20 Jul 19:12
    GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui Akkana Peck 20 Jul 19:44
   GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui Alexandre Prokoudine 20 Jul 20:58
    GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui Joao S. O. Bueno 21 Jul 02:47
Michael Schroeder
2013-07-17 13:18:14 UTC (over 10 years ago)

GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui

Hello Gimp mailing list.

I am writing a plugin for Gimp. It works alright via the GIMP UI and command line by registering it to gimp. But I would wish to offer also a Preview area in the UI, and apparently it is not so easy to add the PreviewArea from the gimpui python package to the input dialog.

Also it is kind of hard to find out who are the gimp python gurus and the documentation is a bit patchy, therefore I would like to ask if people on this list have written python plugins for GIMP including a little preview thumbnail and but not decoupling the plugin from the command line.

It would be nice to have some (documented) python code available as template. Thanks a lot for help and pointers!

Best, Michael

Akkana Peck
2013-07-20 17:22:51 UTC (over 10 years ago)

GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui

Michael Schroeder writes:

I am writing a plugin for Gimp. It works alright via the GIMP UI and command line by registering it to gimp. But I would wish to offer also a Preview area in the UI, and apparently it is not so easy to add the PreviewArea from the gimpui python package to the input dialog.

Since I haven't seen any other responses:

I don't think there's a way to add a formal preview area in Python. But Python does allow you to write any UI you want -- you have the full pygtk library available. So you could make a scaled-down version of the image, do your preview operations to it, and show it in a drawing area.

I'm not sure if there are any good examples of Python scripts that do this. It would be great if someone would try this, write an example and contribute it as pygimp documentation. There are lots of examples for displaying images in pygtk -- I've found that simple to do in other programs -- so it's mostly a matter of getting the GIMP image into a format pygtk can display, and I don't know how hard or easy that is. If you try it, please post a followup here.

...Akkana

Bertrand Denoix
2013-07-20 19:12:56 UTC (over 10 years ago)

GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui

On 07/20/2013 07:22 PM, Akkana Peck wrote:

Michael Schroeder writes:

I am writing a plugin for Gimp. It works alright via the GIMP UI and command line by registering it to gimp. But I would wish to offer also a Preview area in the UI, and apparently it is not so easy to add the PreviewArea from the gimpui python package to the input dialog.

Since I haven't seen any other responses:

I don't think there's a way to add a formal preview area in Python. But Python does allow you to write any UI you want -- you have the full pygtk library available. So you could make a scaled-down version of the image, do your preview operations to it, and show it in a drawing area.

I'm not sure if there are any good examples of Python scripts that do this. It would be great if someone would try this, write an example and contribute it as pygimp documentation. There are lots of examples for displaying images in pygtk -- I've found that simple to do in other programs -- so it's mostly a matter of getting the GIMP image into a format pygtk can display, and I don't know how hard or easy that is. If you try it, please post a followup here.

Not too realistic... pixel-oriented operations in python would be much to slow to be usable in a preview

Akkana Peck
2013-07-20 19:44:17 UTC (over 10 years ago)

GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui

Bertrand Denoix writes:

On 07/20/2013 07:22 PM, Akkana Peck wrote:

But Python does allow you to write any UI you want -- you have the full pygtk library available. So you could make a scaled-down version of the image, do your preview operations to it, and show it in a drawing area.

Not too realistic... pixel-oriented operations in python would be much to slow to be usable in a preview

Anything you can do to the full image in Python, you can do a lot faster to a thumbnail-sized preview, surely?

And pixel operations can be remarkably fast in Python (or remarkably slow, depending on how you set them up). Following methods of GIMP Python expert Joao Bueno, I got my arclayer Python plug-in running nearly as fast as the C version. The write-up: http://shallowsky.com/blog/gimp/pygimp-pixel-ops.html

...Akkana

Alexandre Prokoudine
2013-07-20 20:58:20 UTC (over 10 years ago)

GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui

On Sat, Jul 20, 2013 at 9:22 PM, Akkana Peck wrote:

Michael Schroeder writes:

I am writing a plugin for Gimp. It works alright via the GIMP UI and command line by registering it to gimp. But I would wish to offer also a Preview area in the UI, and apparently it is not so easy to add the PreviewArea from the gimpui python package to the input dialog.

Since I haven't seen any other responses:

I don't think there's a way to add a formal preview area in Python.

AFAIK, that was one of the points of GIMP's GSoC2010 project re Python. The one that was never merged.

Alexandre Prokoudine http://libregraphicsworld.org

Joao S. O. Bueno
2013-07-21 02:47:07 UTC (over 10 years ago)

GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui

On 20 July 2013 17:58, Alexandre Prokoudine wrote:

On Sat, Jul 20, 2013 at 9:22 PM, Akkana Peck wrote:

Michael Schroeder writes:

I am writing a plugin for Gimp. It works alright via the GIMP UI and command line by registering it to gimp. But I would wish to offer also a Preview area in the UI, and apparently it is not so easy to add the PreviewArea from the gimpui python package to the input dialog.

Since I haven't seen any other responses:

I don't think there's a way to add a formal preview area in Python.

AFAIK, that was one of the points of GIMP's GSoC2010 project re Python. The one that was never merged.

That part was not complete, anyway. :-/

But in current GIMP what makes sense is to figure out how to make GEGL calls from GIMP-Python plug-ins, and create an on-screen preview API using the GEGL capabilities. And while one is at that, there is the need port Python-fu from pygtk to gobject introspection as well - I hacked a bit on it a while ago, and I think it can be done while keeping backwards compatibility for python-fu scripts.

js ->

Alexandre Prokoudine
http://libregraphicsworld.org
_______________________________________________ gimp-developer-list mailing list
List address: gimp-developer-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list

Jon Nordby
2013-07-21 10:11:51 UTC (over 10 years ago)

GIMP python (pythonfu) plugin: How to include the PreviewArea from gimpui

On 21 July 2013 04:47, Joao S. O. Bueno wrote:

On 20 July 2013 17:58, Alexandre Prokoudine wrote:

On Sat, Jul 20, 2013 at 9:22 PM, Akkana Peck

wrote:

Michael Schroeder writes:

I am writing a plugin for Gimp. It works alright via the GIMP UI and command line by registering it to gimp. But I would wish to offer also

a

Preview area in the UI, and apparently it is not so easy to add the PreviewArea from the gimpui python package to the input dialog.

Since I haven't seen any other responses:

I don't think there's a way to add a formal preview area in Python.

AFAIK, that was one of the points of GIMP's GSoC2010 project re Python. The one that was never merged.

That part was not complete, anyway. :-/

But in current GIMP what makes sense is to figure out how to make GEGL calls from GIMP-Python plug-ins, and create an on-screen preview API using the GEGL capabilities. And while one is at that, there is the need port Python-fu from pygtk to gobject introspection as well - I hacked a bit on it a while ago, and I think it can be done while keeping backwards compatibility for python-fu scripts.

GI bindings are not very well supported for GTK+2, and probably will never be. So switching to GI makes sense to do together with GTK+3 switch, that is GIMP 3.0. That also means that compatibility does not need to be 100%, though it should be possible to keep most things compatible. In MyPaint we used pygtkcompat and some compat wrappers of our own for that: http://gitorious.org/mypaint/mypaint/blobs/master/gui/gtk2compat.py

One thing that gave us hell is that when using PyGI one cannot import anything that uses PyGTK. Doing so led to instant crash... This might make it neccesary to install an import handler to make sure that plugins don't accidentially pull in PyGTK when the core/new plugins uses PyGI.

As for preview with GEGL, gegl-gtk has a widget should work just fine for that - and will automatically handle updates and transformations. Long-term, I hope that we can find a way for plugins to have on-canvas preview.

Jon Nordby - www.jonnor.com