MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-file-saving.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>File saving</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="The gdk-pixbuf Library">
<link rel="up" href="rn01.html" title="API Reference">
<link rel="prev" href="gdk-pixbuf-file-loading.html" title="File Loading">
<link rel="next" href="gdk-pixbuf-creating.html" title="Image Data in Memory">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="reference" href="rn01.html" title="API Reference">
<link rel="reference" href="rn02.html" title="Tools Reference">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="appendix" href="apa.html" title="Appendix&#160;A.&#160;Porting applications from Imlib to gdk-pixbuf">
<link rel="appendix" href="license.html" title="Appendix&#160;B.&#160;License">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-pixbuf-file-loading.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="rn01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">The <span class="application">gdk-pixbuf</span> Library</th>
<td><a accesskey="n" href="gdk-pixbuf-creating.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3098464" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id3098878" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="gdk-pixbuf-file-saving"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id3098464"></a><span class="refentrytitle">File saving</span>
</h2>
<p>File saving &#8212; Saving a pixbuf to a file.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;gdk-pixbuf/gdk-pixbuf.h&gt;


<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-savev">gdk_pixbuf_savev</a>                (<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                             const char *filename,
                                             const char *type,
                                             char **option_keys,
                                             char **option_values,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save">gdk_pixbuf_save</a>                 (<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                             const char *filename,
                                             const char *type,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                             ...);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    (<a href="gdk-pixbuf-file-saving.html#GdkPixbufSaveFunc">*GdkPixbufSaveFunc</a>)            (const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *buf,
                                             <a
href="../glib/glib-Basic-Types.html#gsize"
>gsize</a> count,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                             <a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback">gdk_pixbuf_save_to_callback</a>     (<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                             <a href="gdk-pixbuf-file-saving.html#GdkPixbufSaveFunc">GdkPixbufSaveFunc</a> save_func,
                                             <a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
                                             const char *type,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                             ...);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callbackv">gdk_pixbuf_save_to_callbackv</a>    (<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                             <a href="gdk-pixbuf-file-saving.html#GdkPixbufSaveFunc">GdkPixbufSaveFunc</a> save_func,
                                             <a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
                                             const char *type,
                                             char **option_keys,
                                             char **option_values,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-buffer">gdk_pixbuf_save_to_buffer</a>       (<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                             <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> **buffer,
                                             <a
href="../glib/glib-Basic-Types.html#gsize"
>gsize</a> *buffer_size,
                                             const char *type,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                             ...);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-bufferv">gdk_pixbuf_save_to_bufferv</a>      (<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                             <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> **buffer,
                                             <a
href="../glib/glib-Basic-Types.html#gsize"
>gsize</a> *buffer_size,
                                             const char *type,
                                             char **option_keys,
                                             char **option_values,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3098878"></a><h2>Description</h2>
<p>
These functions allow to save a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> in a number of 
file formats. The formatted data can be written to a file
or to a memory buffer. <span class="application">gdk-pixbuf</span> 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.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id3098910"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id3098920"></a><h3>
<a name="gdk-pixbuf-savev"></a>gdk_pixbuf_savev ()</h3>
<a class="indexterm" name="id3098933"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    gdk_pixbuf_savev                (<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                             const char *filename,
                                             const char *type,
                                             char **option_keys,
                                             char **option_values,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error);</pre>
<p>
Saves pixbuf to a file in <em class="parameter"><code>type</code></em>, which is currently "jpeg", "png", "tiff", "ico" or "bmp".
If <em class="parameter"><code>error</code></em> is set, <a
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
><code class="literal">FALSE</code></a> will be returned. 
See <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save"><code class="function">gdk_pixbuf_save()</code></a> for more details.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixbuf</code></em>&#160;:</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> name of file to save.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>type</code></em>&#160;:</span></td>
<td> name of file format.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>option_keys</code></em>&#160;:</span></td>
<td> name of options to set, <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>-terminated
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>option_values</code></em>&#160;:</span></td>
<td> values for named options
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td> return location for error, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> whether an error was set
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3099166"></a><h3>
<a name="gdk-pixbuf-save"></a>gdk_pixbuf_save ()</h3>
<a class="indexterm" name="id3099178"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    gdk_pixbuf_save                 (<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                             const char *filename,
                                             const char *type,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                             ...);</pre>
<p>
Saves pixbuf to a file in format <em class="parameter"><code>type</code></em>. By default, "jpeg", "png", "ico" 
and "bmp" are possible file formats to save in, but more formats may be
installed. The list of all writable formats can be determined in the 
following way:
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">
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, &amp;writable_formats);
g_slist_free (formats);
</pre></div>
<p>
</p>
<p>
If <em class="parameter"><code>error</code></em> is set, <a
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
><code class="literal">FALSE</code></a> will be returned. Possible errors include 
those in the <a href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ERROR:CAPS"><span class="type">GDK_PIXBUF_ERROR</span></a> domain and those in the <a
href="../glib/glib-File-Utilities.html#G-FILE-ERROR:CAPS"
><span class="type">G_FILE_ERROR</span></a> domain.
</p>
<p>
The variable argument list should be <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>-terminated; if not empty,
it should contain pairs of strings that modify the save
parameters. For example:
</p>
<div class="informalexample"><pre class="programlisting">
gdk_pixbuf_save (pixbuf, handle, "jpeg", &amp;error,
                 "quality", "100", NULL);
</pre></div>
<p>
</p>
<p>
Currently only few parameters exist. JPEG images can be saved with a
"quality" parameter; its value should be in the range [0,100].
</p>
<p>
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].
</p>
<p>
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.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixbuf</code></em>&#160;:</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></td>
<td> name of file to save.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>type</code></em>&#160;:</span></td>
<td> name of file format.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td> return location for error, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></td>
<td> list of key-value save options
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> whether an error was set
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3099452"></a><h3>
<a name="GdkPixbufSaveFunc"></a>GdkPixbufSaveFunc ()</h3>
<a class="indexterm" name="id3099467"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    (*GdkPixbufSaveFunc)            (const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *buf,
                                             <a
href="../glib/glib-Basic-Types.html#gsize"
>gsize</a> count,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                             <a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data);</pre>
<p>
Specifies the type of the function passed to
<a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback"><code class="function">gdk_pixbuf_save_to_callback()</code></a>.  It is called once for each block of
bytes that is "written" by <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback"><code class="function">gdk_pixbuf_save_to_callback()</code></a>.  If
successful it should return <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>.  If an error occurs it should set
<em class="parameter"><code>error</code></em> and return <a
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
><code class="literal">FALSE</code></a>, in which case <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback"><code class="function">gdk_pixbuf_save_to_callback()</code></a>
will fail with the same error.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>buf</code></em>&#160;:</span></td>
<td>bytes to be written.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>count</code></em>&#160;:</span></td>
<td>number of bytes in <em class="parameter"><code>buf</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td>A location to return an error.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></td>
<td>user data passed to <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback"><code class="function">gdk_pixbuf_save_to_callback()</code></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>
<a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if successful, <a
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
><code class="literal">FALSE</code></a> (with <em class="parameter"><code>error</code></em> set) if failed.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.4


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3099699"></a><h3>
<a name="gdk-pixbuf-save-to-callback"></a>gdk_pixbuf_save_to_callback ()</h3>
<a class="indexterm" name="id3099714"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    gdk_pixbuf_save_to_callback     (<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                             <a href="gdk-pixbuf-file-saving.html#GdkPixbufSaveFunc">GdkPixbufSaveFunc</a> save_func,
                                             <a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
                                             const char *type,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                             ...);</pre>
<p>
Saves pixbuf in format <em class="parameter"><code>type</code></em> by feeding the produced data to a 
callback. Can be used when you want to store the image to something 
other than a file, such as an in-memory buffer or a socket.  
If <em class="parameter"><code>error</code></em> is set, <a
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
><code class="literal">FALSE</code></a> will be returned. Possible errors
include those in the <a href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ERROR:CAPS"><span class="type">GDK_PIXBUF_ERROR</span></a> domain and whatever the save
function generates.
</p>
<p>
See <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save"><code class="function">gdk_pixbuf_save()</code></a> for more details.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixbuf</code></em>&#160;:</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>save_func</code></em>&#160;:</span></td>
<td> a function that is called to save each block of data that
  the save routine generates.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td> user data to pass to the save function.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>type</code></em>&#160;:</span></td>
<td> name of file format.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td> return location for error, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></td>
<td> list of key-value save options
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> whether an error was set

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3099949"></a><h3>
<a name="gdk-pixbuf-save-to-callbackv"></a>gdk_pixbuf_save_to_callbackv ()</h3>
<a class="indexterm" name="id3099965"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    gdk_pixbuf_save_to_callbackv    (<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                             <a href="gdk-pixbuf-file-saving.html#GdkPixbufSaveFunc">GdkPixbufSaveFunc</a> save_func,
                                             <a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
                                             const char *type,
                                             char **option_keys,
                                             char **option_values,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error);</pre>
<p>
Saves pixbuf to a callback in format <em class="parameter"><code>type</code></em>, which is currently "jpeg",
"png", "tiff", "ico" or "bmp".  If <em class="parameter"><code>error</code></em> is set, <a
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
><code class="literal">FALSE</code></a> will be returned. See
<a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback"><code class="function">gdk_pixbuf_save_to_callback()</code></a> for more details.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixbuf</code></em>&#160;:</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>save_func</code></em>&#160;:</span></td>
<td> a function that is called to save each block of data that
  the save routine generates.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td> user data to pass to the save function.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>type</code></em>&#160;:</span></td>
<td> name of file format.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>option_keys</code></em>&#160;:</span></td>
<td> name of options to set, <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>-terminated
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>option_values</code></em>&#160;:</span></td>
<td> values for named options
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td> return location for error, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> whether an error was set

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3100226"></a><h3>
<a name="gdk-pixbuf-save-to-buffer"></a>gdk_pixbuf_save_to_buffer ()</h3>
<a class="indexterm" name="id3100242"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    gdk_pixbuf_save_to_buffer       (<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                             <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> **buffer,
                                             <a
href="../glib/glib-Basic-Types.html#gsize"
>gsize</a> *buffer_size,
                                             const char *type,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                             ...);</pre>
<p>
Saves pixbuf to a new buffer in format <em class="parameter"><code>type</code></em>, which is currently "jpeg",
"png", "tiff", "ico" or "bmp".  This is a convenience function that uses
<a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback"><code class="function">gdk_pixbuf_save_to_callback()</code></a> to do the real work. Note that the buffer 
is not nul-terminated and may contain embedded  nuls.
If <em class="parameter"><code>error</code></em> is set, <a
href="../glib/glib-Standard-Macros.html#FALSE:CAPS"
><code class="literal">FALSE</code></a> will be returned and <em class="parameter"><code>string</code></em> will be set to
<a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>. Possible errors include those in the <a href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ERROR:CAPS"><span class="type">GDK_PIXBUF_ERROR</span></a>
domain.
</p>
<p>
See <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save"><code class="function">gdk_pixbuf_save()</code></a> for more details.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixbuf</code></em>&#160;:</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>buffer</code></em>&#160;:</span></td>
<td> location to receive a pointer to the new buffer.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>buffer_size</code></em>&#160;:</span></td>
<td> location to receive the size of the new buffer.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>type</code></em>&#160;:</span></td>
<td> name of file format.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td> return location for error, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></td>
<td> list of key-value save options
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> whether an error was set

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3100504"></a><h3>
<a name="gdk-pixbuf-save-to-bufferv"></a>gdk_pixbuf_save_to_bufferv ()</h3>
<a class="indexterm" name="id3100520"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a>    gdk_pixbuf_save_to_bufferv      (<a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                             <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> **buffer,
                                             <a
href="../glib/glib-Basic-Types.html#gsize"
>gsize</a> *buffer_size,
                                             const char *type,
                                             char **option_keys,
                                             char **option_values,
                                             <a
href="../glib/glib-Error-Reporting.html#GError"
>GError</a> **error);</pre>
<p>
Saves pixbuf to a new buffer in format <em class="parameter"><code>type</code></em>, which is currently "jpeg",
"tiff", "png", "ico" or "bmp".  See <a href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-buffer"><code class="function">gdk_pixbuf_save_to_buffer()</code></a> for more details.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pixbuf</code></em>&#160;:</span></td>
<td> a <a href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>buffer</code></em>&#160;:</span></td>
<td> location to receive a pointer to the new buffer.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>buffer_size</code></em>&#160;:</span></td>
<td> location to receive the size of the new buffer.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>type</code></em>&#160;:</span></td>
<td> name of file format.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>option_keys</code></em>&#160;:</span></td>
<td> name of options to set, <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>-terminated
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>option_values</code></em>&#160;:</span></td>
<td> values for named options
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></td>
<td> return location for error, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> whether an error was set

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.4
</p>
</div>
</div>
</div>
</body>
</html>