5

I know that Gdk-Pixbuf supports png and jpg, but I cannot find an exact list of all the completely (or partially) supported image formats anywhere on the internet. It is necessary for my current project, since I need to check the extension of every file in a directory and determine whether it is supported or not by gdk-pixbuf. Any help?

ApprenticeHacker
  • 21,351
  • 27
  • 103
  • 153
  • GdkPixbuf is an standard for keeping raw image data, so GdkPixbufLoaders are the ones who support loading jpg/png into GdkPixbuf, so you should read about GdkPixbuf loaders, and check which one support your environment – erick2red Oct 11 '11 at 13:32

3 Answers3

7

I know this is 5+ years old but I had trouble finding this for PyGI / PyGObject (3.22.0).

import gi.repository.GdkPixbuf as pixbuf

Then we can get all the formats using:

for f in pixbuf.Pixbuf.get_formats():
    print f.get_name()

On my system (might be different on yours if you installed other loaders), I get:

  • ani
  • bmp
  • GdkPixdata
  • gif
  • icns
  • ico
  • jpeg
  • png
  • pnm
  • qtif
  • svg
  • tga
  • tiff
  • wmf
  • xbm
  • xpm
liberforce
  • 11,189
  • 37
  • 48
Max
  • 71
  • 1
  • 1
  • List supported formats along with their MIME types: `python3 -c "import gi.repository.GdkPixbuf as pixbuf;from pprint import pprint;pprint([(f.get_name(), f.get_mime_types()) for f in pixbuf.Pixbuf.get_formats()])"` – gwyn Feb 20 '22 at 21:26
3

Calling gdk_pixbuf_get_formats() in your application will tell you which formats your copy of GDKPixbuf can load.

ptomato
  • 56,175
  • 13
  • 112
  • 165
1

This should be available by querying gdk-pixbuf-loaders. Here is more information on pixbuf modules and supported formats.

liberforce
  • 11,189
  • 37
  • 48
  • Please have a look at this. http://stackoverflow.com/questions/7711638/how-to-disconnect-an-accelerator-or-key-press-event-in-a-gtk-widget – ApprenticeHacker Oct 10 '11 at 10:44