I am trying to save the content of a GdkPixbuf.Pixbuf object to a file in Python 2.7.
It seems that the Pixbuf.save() method that appears in the documentation is not available from Python, and only Pixbuf.savev() is available.
I have searched high and low for the correct syntax for the method when used in Python, but all available examples use the old syntax:
pixbuf.savev("frame.jpg", "jpg", {"quality":"100"})
Trying this with Gtk3 throws an error such that I need to provide 4 parameters. Supposedly I have to split "quality" and "100" into two parameters. However, doing this throws an error:
pixbuf.savev("frame.jpg", "jpg", "quality", "100")
The Python interpreter replies with:
(GTKSample.py:9906): GdkPixbuf-WARNING **: Unrecognized parameter (q) passed to JPEG saver.
(GTKSample.py:9906): GdkPixbuf-WARNING **: Unrecognized parameter (u) passed to JPEG saver.
(GTKSample.py:9906): GdkPixbuf-WARNING **: Unrecognized parameter (a) passed to JPEG saver.
(GTKSample.py:9906): GdkPixbuf-WARNING **: Unrecognized parameter (l) passed to JPEG saver.
(GTKSample.py:9906): GdkPixbuf-WARNING **: Unrecognized parameter (i) passed to JPEG saver.
Etcetera. I would appreciate if someone would tell me the correct way to save a GdkPixbuf to a file in Python.
By request, I'm posting the answer I found on my own in comments as "the answer".
The correct syntax to save a Gtk3 pixbuf as an image is, for example:
pixbuf.savev("frame.jpg", "jpeg", ["quality"], ["100"])