The gdk-pixbuf Library
<<< Previous Page | Home | Up | Next Page >>>

# File saving

## Name

File saving -- Saving a pixbuf to a file.

## 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,
                                                 ...);

## Description

## Details

### gdk_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 `type`, which is currently "jpeg" or "png". If `error` is set, `FALSE` will be returned. See gdk_pixbuf_save() for more details.

`pixbuf` : | a GdkPixbuf.
`filename` : | name of file to save.
`type` : | name of file format.
`option_keys` : | name of options to set, `NULL`-terminated
`option_values` : | values for named options
`error` : | return location for error, or `NULL`
Returns : | whether an error was set

### gdk_pixbuf_save ()

    gboolean    gdk_pixbuf_save                 (GdkPixbuf *pixbuf,
                                                 const char *filename,
                                                 const char *type,
                                                 GError **error,
                                                 ...);

Saves pixbuf to a file in `type`, which is currently "jpeg" or "png". If `error` is set, `FALSE` will be returned. Possible errors include those in the GDK_PIXBUF_ERROR domain and those in the G_FILE_ERROR domain.

The variable argument list should be `NULL`-terminated; if not empty, it should contain pairs of strings that modify the save parameters. For example:

    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. Note however that PNG text chunks are stored in ISO-8859-1 encoding, so you can only set texts that can be represented in this encoding.

`pixbuf` : | a GdkPixbuf.
`filename` : | name of file to save.
`type` : | name of file format.
`error` : | return location for error, or `NULL`
`...` : | list of key-value save options
Returns : | whether an error was set

<<< Previous Page | Home | Up | Next Page >>>
File Loading | Image Data in Memory