It is currently Thu Apr 25, 2024 8:31 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: GimpPreview API in Python ?
PostPosted: Thu Jul 05, 2012 10:56 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2246
Location: Poland
http://registry.gimp.org/node/26562
John writes:
Is there a way to utilize GimpPreview (or live preview window) api in a Python plugin? I can't find any tutorials or plugins using it and most resources are several years old.

This is not a solution - but maybe some direction.
Probably the only plugin (py) displays the image in your window is: GimpPublishr by Jayesh Salvi.
http://code.google.com/p/altcanvas/wiki/GimpPublishr

I'm not a programmer- can anyone look at the code?

The Annex - Image_in_python.py ( fragment of plugin GimpPublishr ).
In Gimp menu: File - > Image in plugin python
It does not do anything - just displays the image (without scaling and not every type of file).

Does anyone have an idea how to add (in gdkpixbuf.py) proper behavior scale ?

Can it be useful for something beyond the additional preview ?


Attachments:
Publishr-gimp.png
Publishr-gimp.png [ 176.53 KiB | Viewed 3285 times ]
Only preview.png
Only preview.png [ 236.99 KiB | Viewed 3285 times ]
Image_in_Python.zip [3.22 KiB]
Downloaded 158 times

_________________
Image

Slava
Ukraini!
Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: GimpPreview API in Python ?
PostPosted: Tue Feb 05, 2013 11:42 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2246
Location: Poland
I saw an idea garagecoder:
http://www.flickr.com/groups/gmic/discuss/72157632674501653/
Question for GC:
wxwidgets can be used as a preview for each file Python?
Can I ask for more information (for beginners on this issue)?


Attachments:
GC-tool.png
GC-tool.png [ 90.09 KiB | Viewed 2631 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: GimpPreview API in Python ?
PostPosted: Tue Feb 05, 2013 2:54 pm  (#3) 
Offline
GimpChat Member

Joined: Sep 24, 2012
Posts: 275
Location: Scotland
Hi MareroQ
I'm not sure if I understand your question correctly, but I think you're asking if it's possible to have a preview window in a gimp python plugin. I think it's always been possible using a C wrapper, but according to this thread it should be possible directly from python now:

http://forum.meetthegimp.org/index.php?topic=87.0

I'm afraid it's not something I know a lot about, you could definitely write a C wrapper to do it but that's not something I'll be working on for now. If anything GTK will be what you need (not wxwidgets) to interface with.

*edit* there are some things I'm working on, documentation of gmic with wxwidgets and possibly a python wrapper for gmic (which I have already tested at a basic level). But don't hold your breath waiting!


Top
 Post subject: Re: GimpPreview API in Python ?
PostPosted: Tue Feb 05, 2013 3:27 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2246
Location: Poland
This could be your revolution for Gimp Python.
(Unfortunately, my options are limited by the lack of a good knowledge of the English language).
Can you put the code somewhere (and instructions) on how you obtain GCTool

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: GimpPreview API in Python ?
PostPosted: Tue Feb 05, 2013 3:34 pm  (#5) 
Offline
GimpChat Member

Joined: Sep 24, 2012
Posts: 275
Location: Scotland
Hah I knew it would be dangerous to show it so early :)
I made it as a quick and dirty test of gmiclib with wxwidgets. The code is ugly. I'm not even a c++ programmer. But... once I have it to a reasonable state the code will be released, along with docs on the gmic wiki (which is the main reason for creating it).

Anyway back to your python question now that you got me interested, I had a look at the python script and I see "import gtk.gdk" and "import gtk" so basically the plugin is creating it's own GUI using a gtk python module. Beyond that I can't help without spending a lot of time learning python... hmm I'm so easily distracted :roll:


Top
 Post subject: Re: GimpPreview API in Python ?
PostPosted: Tue Feb 05, 2013 3:40 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
garagecoder wrote:
... according to this thread it should be possible directly from python now:
http://forum.meetthegimp.org/index.php?topic=87.0


I've tried a number of times to get this working with no success. Possibly a more experienced python coder might have better luck than I.

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: GimpPreview API in Python ?
PostPosted: Tue Feb 05, 2013 3:51 pm  (#7) 
Offline
GimpChat Member

Joined: Sep 24, 2012
Posts: 275
Location: Scotland
Does somebody have a link to a recent version of "gimpui" python module? Perhaps just looking at the defs/classes in that would shed some light. Anyway I'm out of my depth here so I'll leave it to some flyby expert (I hope!).


Top
 Post subject: Re: GimpPreview API in Python ?
PostPosted: Tue Feb 05, 2013 4:28 pm  (#8) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2246
Location: Poland
For a beginner is not consolation
experienced programmer (Rob'A) has the same problem - with an image in Python for GIMP plugin - a much-needed solution - any idea on weight in gold

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: GimpPreview API in Python ?
PostPosted: Tue Feb 05, 2013 4:49 pm  (#9) 
Offline
GimpChat Member

Joined: Sep 24, 2012
Posts: 275
Location: Scotland
OK well if it is something a few people want, I'll look into it tomorrow. If it starts taking me days I won't be doing it though, so no promises!


Top
 Post subject: Re: GimpPreview API in Python ?
PostPosted: Wed Feb 06, 2013 3:26 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2246
Location: Poland
"Tomorrow Never Dies".
Apparently, time is money –when ?

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: GimpPreview API in Python ?
PostPosted: Wed Feb 06, 2013 7:21 am  (#11) 
Offline
GimpChat Member

Joined: Sep 24, 2012
Posts: 275
Location: Scotland
Relax, just a couple things I have to do to get started (learn python, learn how to create a gimp python script) so it's not going to be immediate :)


Top
 Post subject: Re: GimpPreview API in Python ?
PostPosted: Wed Feb 06, 2013 1:17 pm  (#12) 
Offline
GimpChat Member

Joined: Sep 24, 2012
Posts: 275
Location: Scotland
OK you're probably not going to like this answer :(
Preview doesn't seem to be implemented for "normal" gimp python plugins i.e. using gimpui module. I searched through all the modules and even the C wrappers. You would have to create the window from scratch using python gtk module instead (as the example you gave does), which for a non-programmer is not easy - and there's no way I can give a demonstration without spending a lot of time learning it.

@ RobA - I'd like to know which classes/defs you attempted to use! I noticed PF_DISPLAY isn't functional but I think it's to do with opening a new display which you can do with gimp.display() anyway.


Top
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Convert GIMP plugin from Python 2 to Python 3

4

No new posts Difference between "Python-Fu" and "Python" plugin

6

No new posts Python 3 With GIMP 2

0

No new posts Attachment(s) Help with pdb.plug_in_displace when using python-fu

4

No new posts Help with pdb.plug_in_displace when using python-fu in OS X

1



* Login  



Powered by phpBB3 © phpBB Group