Synopsis#include <gdk-pixbuf/gdk-pixbuf.h> gboolean gdk_pixbuf_savev (GdkPixbuf *pixbuf, const char *filename, const char *type, char **option_keys, char **option_values, GError **error); gboolean gdk_pixbuf_save (GdkPixbuf *pixbuf, const char *filename, const char *type, GError **error, ...); gboolean (*GdkPixbufSaveFunc) (const gchar *buf, gsize count, GError **error, gpointer data); gboolean gdk_pixbuf_save_to_callback (GdkPixbuf *pixbuf, GdkPixbufSaveFunc save_func, gpointer user_data, const char *type, GError **error, ...); gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf, GdkPixbufSaveFunc save_func, gpointer user_data, const char *type, char **option_keys, char **option_values, GError **error); gboolean gdk_pixbuf_save_to_buffer (GdkPixbuf *pixbuf, gchar **buffer, gsize *buffer_size, const char *type, GError **error, ...); gboolean gdk_pixbuf_save_to_bufferv (GdkPixbuf *pixbuf, gchar **buffer, gsize *buffer_size, const char *type, char **option_keys, char **option_values, GError **error); gboolean gdk_pixbuf_save_to_stream (GdkPixbuf *pixbuf, GOutputStream *stream, const char *type, GCancellable *cancellable, GError **error, ...); DescriptionThese functions allow to save a GdkPixbuf in a number of file formats. The formatted data can be written to a file or to a memory buffer. gdk-pixbuf can also call a user-defined callback on the data, which allows to e.g. write the image to a socket or store it in a database. Detailsgdk_pixbuf_savev ()gboolean gdk_pixbuf_savev (GdkPixbuf *pixbuf, const char *filename, const char *type, char **option_keys, char **option_values, GError **error);
Saves pixbuf to a file in
gdk_pixbuf_save ()gboolean gdk_pixbuf_save (GdkPixbuf *pixbuf, const char *filename, const char *type, GError **error, ...);
Saves pixbuf to a file in format
void add_if_writable (GdkPixbufFormat *data, GSList **list) { if (gdk_pixbuf_format_is_writable (data)) *list = g_slist_prepend (*list, data); } GSList *formats = gdk_pixbuf_get_formats (); GSList *writable_formats = NULL; g_slist_foreach (formats, add_if_writable, &writable_formats); g_slist_free (formats);
If
The variable argument list should be gdk_pixbuf_save (pixbuf, handle, "jpeg", &error, "quality", "100", NULL);
Currently only few parameters exist. JPEG images can be saved with a "quality" parameter; its value should be in the range [0,100]. Text chunks can be attached to PNG images by specifying parameters of the form "tEXt::key", where key is an ASCII string of length 1-79. The values are UTF-8 encoded strings. The PNG compression level can be specified using the "compression" parameter; it's value is in an integer in the range of [0,9]. ICO images can be saved in depth 16, 24, or 32, by using the "depth" parameter. When the ICO saver is given "x_hot" and "y_hot" parameters, it produces a CUR instead of an ICO.
GdkPixbufSaveFunc ()gboolean (*GdkPixbufSaveFunc) (const gchar *buf, gsize count, GError **error, gpointer data);
Specifies the type of the function passed to
Since 2.4 gdk_pixbuf_save_to_callback ()gboolean gdk_pixbuf_save_to_callback (GdkPixbuf *pixbuf, GdkPixbufSaveFunc save_func, gpointer user_data, const char *type, GError **error, ...);
Saves pixbuf in format
See
Since 2.4 gdk_pixbuf_save_to_callbackv ()gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf, GdkPixbufSaveFunc save_func, gpointer user_data, const char *type, char **option_keys, char **option_values, GError **error);
Saves pixbuf to a callback in format
Since 2.4 gdk_pixbuf_save_to_buffer ()gboolean gdk_pixbuf_save_to_buffer (GdkPixbuf *pixbuf, gchar **buffer, gsize *buffer_size, const char *type, GError **error, ...);
Saves pixbuf to a new buffer in format
See
Since 2.4 gdk_pixbuf_save_to_bufferv ()gboolean gdk_pixbuf_save_to_bufferv (GdkPixbuf *pixbuf, gchar **buffer, gsize *buffer_size, const char *type, char **option_keys, char **option_values, GError **error);
Saves pixbuf to a new buffer in format
Since 2.4 gdk_pixbuf_save_to_stream ()gboolean gdk_pixbuf_save_to_stream (GdkPixbuf *pixbuf, GOutputStream *stream, const char *type, GCancellable *cancellable, GError **error, ...);
Saves
Supported file formats are currently "jpeg", "tiff", "png", "ico" or
"bmp". See
The The stream is not closed.
Since 2.14 |