It is currently Tue Jul 23, 2024 10:17 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Is it possible to create a gtk.gdk.Pixbuf from a GIMP image using Pyth
PostPosted: Thu Jun 19, 2014 4:32 pm  (#1) 
Offline
GimpChat Member

Joined: Mar 01, 2014
Posts: 8
Greetings fellow scripters!

I wonder if anyone know of a method that would make it possible to create a gtk.gdk.Pixbuf from a GIMP image using Python? Googling around, I have found several examples (not Python, though) of going from a pixbuf to a GIMP image, but not the other way.

The reason I am searching for this is that I am working on a file chooser dialog for a plugin since I am not a fan of gimpfu’s file chooser implementation: I think it is kind of annoying that it has this weird pre-dialog where the user has to click on a folder icon to get to the real file chooser dialog. Then, when a file is chosen and OK is clicked, the user is sent back to the pre-dialog and has to click OK again to finally choose the file. I can see the advantage of this if choosing a file is part of a bigger menu, but not if it is the only purpose of the dialog.

Moreover, there is no preview in the file chooser dialog as there is in GIMP’s native Open File dialog and that’s where I am currently challenged.

The file chooser dialog itself is pretty simple to make via gtk.FileChooserDialog, which also has functions for implementing a preview. For the preview, I simply read each selected file into a gtk.gdk.Pixbuf, scale it and add it to a gtk.Image. It works wonderfully. However, it will only preview standard image formats such as jpeg, png, gif and bmp, whereas GIMPs Open File dialog will preview pretty much all the formats that GIMP can open including pdf and psd.

If I could just get a GIMP image into a gtk.gdk.Pixbuf, I would be able to show previews of the same format types. Any help is greatly appreciated – also if you have other ideas on how one could implement this I would be very interested. Thanks :)


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Create Seamless Hexagon Pattern from Image - within seconds

0

No new posts Retexture an image with another image as "Image Pattern" Plug-in

4

No new posts Show image on web browser to fill 100% width AND image map

2

No new posts Attachment(s) How can I create this border?

4

No new posts How to create a displacement map

1



* Login  



Powered by phpBB3 © phpBB Group