<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>GDK-PixBuf Reference Manual: File saving</title> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> <link rel="home" href="index.html" title="GDK-PixBuf Reference Manual"> <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-Image-Data-in-Memory.html" title="Image Data in Memory"> <meta name="generator" content="GTK-Doc V1.20.1 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </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="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"> <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> <a href="#gdk-pixbuf-File-saving.description" class="shortcut">Description</a></span> </td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="rn01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="gdk-pixbuf-File-Loading.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="gdk-pixbuf-Image-Data-in-Memory.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="refentry"> <a name="gdk-pixbuf-File-saving"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle"><a name="gdk-pixbuf-File-saving.top_of_page"></a>File saving</span></h2> <p>File saving — Saving a pixbuf to a file.</p> </td> <td class="gallery_image" valign="top" align="right"></td> </tr></table></div> <div class="refsect1"> <a name="gdk-pixbuf-File-saving.functions"></a><h2>Functions</h2> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="functions_return"> <col class="functions_name"> </colgroup> <tbody> <tr> <td class="function_type"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-savev" title="gdk_pixbuf_savev ()">gdk_pixbuf_savev</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save" title="gdk_pixbuf_save ()">gdk_pixbuf_save</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <span class="c_punctuation">(</span><a class="link" href="gdk-pixbuf-File-saving.html#GdkPixbufSaveFunc" title="GdkPixbufSaveFunc ()">*GdkPixbufSaveFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-callback" title="gdk_pixbuf_save_to_callback ()">gdk_pixbuf_save_to_callback</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-callbackv" title="gdk_pixbuf_save_to_callbackv ()">gdk_pixbuf_save_to_callbackv</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-buffer" title="gdk_pixbuf_save_to_buffer ()">gdk_pixbuf_save_to_buffer</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-bufferv" title="gdk_pixbuf_save_to_bufferv ()">gdk_pixbuf_save_to_bufferv</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-stream" title="gdk_pixbuf_save_to_stream ()">gdk_pixbuf_save_to_stream</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-stream-async" title="gdk_pixbuf_save_to_stream_async ()">gdk_pixbuf_save_to_stream_async</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-stream-finish" title="gdk_pixbuf_save_to_stream_finish ()">gdk_pixbuf_save_to_stream_finish</a> <span class="c_punctuation">()</span> </td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="gdk-pixbuf-File-saving.includes"></a><h2>Includes</h2> <pre class="synopsis">#include <gdk-pixbuf/gdk-pixbuf.h> </pre> </div> <div class="refsect1"> <a name="gdk-pixbuf-File-saving.description"></a><h2>Description</h2> <p>These functions allow to save a <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.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. GdkPixBuf 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"> <a name="gdk-pixbuf-File-saving.functions_details"></a><h2>Functions</h2> <div class="refsect2"> <a name="gdk-pixbuf-savev"></a><h3>gdk_pixbuf_savev ()</h3> <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gdk_pixbuf_savev (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>, <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>, <em class="parameter"><code>const <span class="type">char</span> *type</code></em>, <em class="parameter"><code><span class="type">char</span> **option_keys</code></em>, <em class="parameter"><code><span class="type">char</span> **option_values</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</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="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> will be returned. See <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save" title="gdk_pixbuf_save ()"><code class="function">gdk_pixbuf_save()</code></a> for more details.</p> <div class="refsect3"> <a name="id-1.2.7.6.2.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>pixbuf</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>filename</p></td> <td class="parameter_description"><p>name of file to save.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>type</p></td> <td class="parameter_description"><p>name of file format.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>option_keys</p></td> <td class="parameter_description"><p> name of options to set, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1]</span></td> </tr> <tr> <td class="parameter_name"><p>option_values</p></td> <td class="parameter_description"><p> values for named options. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p> return location for error, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.2.7.6.2.6"></a><h4>Returns</h4> <p> whether an error was set</p> <p></p> </div> </div> <hr> <div class="refsect2"> <a name="gdk-pixbuf-save"></a><h3>gdk_pixbuf_save ()</h3> <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gdk_pixbuf_save (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>, <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>, <em class="parameter"><code>const <span class="type">char</span> *type</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>, <em class="parameter"><code>...</code></em>);</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> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1 2 3 4 5 6 7 8 9 10</pre></td> <td class="listing_code"><pre class="programlisting"><span class="type">void</span><span class="normal"> </span><span class="function">add_if_writable</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GdkPixbufFormat</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">data</span><span class="symbol">,</span><span class="normal"> </span><span class="usertype">GSList</span><span class="normal"> </span><span class="symbol">**</span><span class="normal">list</span><span class="symbol">)</span> <span class="cbracket">{</span> <span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="gdk-pixbuf-Module-Interface.html#gdk-pixbuf-format-is-writable">gdk_pixbuf_format_is_writable</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">data</span><span class="symbol">))</span> <span class="normal"> </span><span class="symbol">*</span><span class="normal">list </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Singly-Linked-Lists.html#g-slist-prepend">g_slist_prepend</a></span><span class="normal"> </span><span class="symbol">(*</span><span class="normal">list</span><span class="symbol">,</span><span class="normal"> data</span><span class="symbol">);</span> <span class="cbracket">}</span> <span class="usertype">GSList</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">formats </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gdk-pixbuf-Module-Interface.html#gdk-pixbuf-get-formats">gdk_pixbuf_get_formats</a></span><span class="normal"> </span><span class="symbol">();</span> <span class="usertype">GSList</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">writable_formats </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span> <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Singly-Linked-Lists.html#g-slist-foreach">g_slist_foreach</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">formats</span><span class="symbol">,</span><span class="normal"> add_if_writable</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">writable_formats</span><span class="symbol">);</span> <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Singly-Linked-Lists.html#g-slist-free">g_slist_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">formats</span><span class="symbol">);</span></pre></td> </tr> </tbody> </table> </div> <p></p> <p>If <em class="parameter"><code>error</code></em> is set, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> will be returned. Possible errors include those in the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> domain and those in the <a href="http://library.gnome.org/devel/glib/unstable/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="http://library.gnome.org/devel/glib/unstable/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"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1</pre></td> <td class="listing_code"><pre class="programlisting"><span class="function"><a href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save">gdk_pixbuf_save</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">pixbuf</span><span class="symbol">,</span><span class="normal"> handle</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"jpeg"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">error</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"quality"</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"100"</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span></pre></td> </tr> </tbody> </table> </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>ICC color profiles can also be embedded into PNG, JPEG and TIFF images. The "icc-profile" value should be the complete ICC profile encoded into base64.</p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1 2 3 4 5 6</pre></td> <td class="listing_code"><pre class="programlisting"><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">contents</span><span class="symbol">;</span> <span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">contents_encode</span><span class="symbol">;</span> <span class="usertype">gsize</span><span class="normal"> length</span><span class="symbol">;</span> <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-File-Utilities.html#g-file-get-contents">g_file_get_contents</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"/home/hughsie/.color/icc/L225W.icm"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">contents</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">length</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span> <span class="normal">contents_encode </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Base64-Encoding.html#g-base64-encode">g_base64_encode</a></span><span class="normal"> </span><span class="symbol">((</span><span class="keyword">const</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guchar">guchar</a> </span><span class="symbol">*)</span><span class="normal"> contents</span><span class="symbol">,</span><span class="normal"> length</span><span class="symbol">);</span> <span class="function"><a href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save">gdk_pixbuf_save</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">pixbuf</span><span class="symbol">,</span><span class="normal"> handle</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"png"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">error</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"icc-profile"</span><span class="symbol">,</span><span class="normal"> contents_encode</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span></pre></td> </tr> </tbody> </table> </div> <p></p> <p>TIFF images recognize a "compression" option which acceps an integer value. Among the codecs are 1 None, 2 Huffman, 5 LZW, 7 JPEG and 8 Deflate, see the libtiff documentation and tiff.h for all supported codec values.</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> <div class="refsect3"> <a name="id-1.2.7.6.3.18"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>pixbuf</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>filename</p></td> <td class="parameter_description"><p>name of file to save.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>type</p></td> <td class="parameter_description"><p>name of file format.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p> return location for error, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>...</p></td> <td class="parameter_description"><p>list of key-value save options, followed by <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.2.7.6.3.19"></a><h4>Returns</h4> <p> whether an error was set</p> <p></p> </div> </div> <hr> <div class="refsect2"> <a name="GdkPixbufSaveFunc"></a><h3>GdkPixbufSaveFunc ()</h3> <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <span class="c_punctuation">(</span>*GdkPixbufSaveFunc<span class="c_punctuation">)</span> (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *buf</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> count</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre> <p>Specifies the type of the function passed to <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-callback" title="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 class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-callback" title="gdk_pixbuf_save_to_callback ()"><code class="function">gdk_pixbuf_save_to_callback()</code></a>. If successful it should return <a href="http://library.gnome.org/devel/glib/unstable/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="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, in which case <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-callback" title="gdk_pixbuf_save_to_callback ()"><code class="function">gdk_pixbuf_save_to_callback()</code></a> will fail with the same error.</p> <div class="refsect3"> <a name="id-1.2.7.6.4.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>buf</p></td> <td class="parameter_description"><p> bytes to be written. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=count][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td> </tr> <tr> <td class="parameter_name"><p>count</p></td> <td class="parameter_description"><p>number of bytes in <em class="parameter"><code>buf</code></em> . </p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p> A location to return an error. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>data</p></td> <td class="parameter_description"><p> user data passed to <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-callback" title="gdk_pixbuf_save_to_callback ()"><code class="function">gdk_pixbuf_save_to_callback()</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.2.7.6.4.6"></a><h4>Returns</h4> <p> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if successful, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> (with <em class="parameter"><code>error</code></em> set) if failed.</p> <p></p> </div> <p class="since">Since 2.4</p> </div> <hr> <div class="refsect2"> <a name="gdk-pixbuf-save-to-callback"></a><h3>gdk_pixbuf_save_to_callback ()</h3> <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gdk_pixbuf_save_to_callback (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>, <em class="parameter"><code><a class="link" href="gdk-pixbuf-File-saving.html#GdkPixbufSaveFunc" title="GdkPixbufSaveFunc ()"><span class="type">GdkPixbufSaveFunc</span></a> save_func</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>, <em class="parameter"><code>const <span class="type">char</span> *type</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>, <em class="parameter"><code>...</code></em>);</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="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> will be returned. Possible errors include those in the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> domain and whatever the save function generates.</p> <p>See <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save" title="gdk_pixbuf_save ()"><code class="function">gdk_pixbuf_save()</code></a> for more details.</p> <div class="refsect3"> <a name="id-1.2.7.6.5.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>pixbuf</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>save_func</p></td> <td class="parameter_description"><p> a function that is called to save each block of data that the save routine generates. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid only during the call to the method."><span class="acronym">scope call</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>user_data</p></td> <td class="parameter_description"><p>user data to pass to the save function.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>type</p></td> <td class="parameter_description"><p>name of file format.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p> return location for error, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>...</p></td> <td class="parameter_description"><p>list of key-value save options</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.2.7.6.5.7"></a><h4>Returns</h4> <p> whether an error was set</p> <p></p> </div> <p class="since">Since 2.4</p> </div> <hr> <div class="refsect2"> <a name="gdk-pixbuf-save-to-callbackv"></a><h3>gdk_pixbuf_save_to_callbackv ()</h3> <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gdk_pixbuf_save_to_callbackv (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>, <em class="parameter"><code><a class="link" href="gdk-pixbuf-File-saving.html#GdkPixbufSaveFunc" title="GdkPixbufSaveFunc ()"><span class="type">GdkPixbufSaveFunc</span></a> save_func</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>, <em class="parameter"><code>const <span class="type">char</span> *type</code></em>, <em class="parameter"><code><span class="type">char</span> **option_keys</code></em>, <em class="parameter"><code><span class="type">char</span> **option_values</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</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="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> will be returned. See <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-callback" title="gdk_pixbuf_save_to_callback ()"><code class="function">gdk_pixbuf_save_to_callback()</code></a> for more details.</p> <div class="refsect3"> <a name="id-1.2.7.6.6.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>pixbuf</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>save_func</p></td> <td class="parameter_description"><p> a function that is called to save each block of data that the save routine generates. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid only during the call to the method."><span class="acronym">scope call</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>user_data</p></td> <td class="parameter_description"><p> user data to pass to the save function. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>type</p></td> <td class="parameter_description"><p>name of file format.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>option_keys</p></td> <td class="parameter_description"><p> name of options to set, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8]</span></td> </tr> <tr> <td class="parameter_name"><p>option_values</p></td> <td class="parameter_description"><p> values for named options. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p> return location for error, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.2.7.6.6.6"></a><h4>Returns</h4> <p> whether an error was set</p> <p></p> </div> <p class="since">Since 2.4</p> </div> <hr> <div class="refsect2"> <a name="gdk-pixbuf-save-to-buffer"></a><h3>gdk_pixbuf_save_to_buffer ()</h3> <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gdk_pixbuf_save_to_buffer (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> **buffer</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> *buffer_size</code></em>, <em class="parameter"><code>const <span class="type">char</span> *type</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>, <em class="parameter"><code>...</code></em>);</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 class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-callback" title="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="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> will be returned and <em class="parameter"><code>buffer</code></em> will be set to <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. Possible errors include those in the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> domain.</p> <p>See <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save" title="gdk_pixbuf_save ()"><code class="function">gdk_pixbuf_save()</code></a> for more details.</p> <div class="refsect3"> <a name="id-1.2.7.6.7.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>pixbuf</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>buffer</p></td> <td class="parameter_description"><p> location to receive a pointer to the new buffer. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=buffer_size][<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td> </tr> <tr> <td class="parameter_name"><p>buffer_size</p></td> <td class="parameter_description"><p>location to receive the size of the new buffer.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>type</p></td> <td class="parameter_description"><p>name of file format.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p> return location for error, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>...</p></td> <td class="parameter_description"><p>list of key-value save options</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.2.7.6.7.7"></a><h4>Returns</h4> <p> whether an error was set</p> <p></p> </div> <p class="since">Since 2.4</p> </div> <hr> <div class="refsect2"> <a name="gdk-pixbuf-save-to-bufferv"></a><h3>gdk_pixbuf_save_to_bufferv ()</h3> <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gdk_pixbuf_save_to_bufferv (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> **buffer</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> *buffer_size</code></em>, <em class="parameter"><code>const <span class="type">char</span> *type</code></em>, <em class="parameter"><code><span class="type">char</span> **option_keys</code></em>, <em class="parameter"><code><span class="type">char</span> **option_values</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</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 class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-buffer" title="gdk_pixbuf_save_to_buffer ()"><code class="function">gdk_pixbuf_save_to_buffer()</code></a> for more details.</p> <div class="refsect3"> <a name="id-1.2.7.6.8.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>pixbuf</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>buffer</p></td> <td class="parameter_description"><p> location to receive a pointer to the new buffer. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=buffer_size][<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td> </tr> <tr> <td class="parameter_name"><p>buffer_size</p></td> <td class="parameter_description"><p>location to receive the size of the new buffer.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>type</p></td> <td class="parameter_description"><p>name of file format.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>option_keys</p></td> <td class="parameter_description"><p> name of options to set, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1]</span></td> </tr> <tr> <td class="parameter_name"><p>option_values</p></td> <td class="parameter_description"><p> values for named options. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p> return location for error, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.2.7.6.8.6"></a><h4>Returns</h4> <p> whether an error was set</p> <p></p> </div> <p class="since">Since 2.4</p> </div> <hr> <div class="refsect2"> <a name="gdk-pixbuf-save-to-stream"></a><h3>gdk_pixbuf_save_to_stream ()</h3> <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gdk_pixbuf_save_to_stream (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GOutputStream.html"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code>const <span class="type">char</span> *type</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>, <em class="parameter"><code>...</code></em>);</pre> <p>Saves <em class="parameter"><code>pixbuf</code></em> to an output stream.</p> <p>Supported file formats are currently "jpeg", "tiff", "png", "ico" or "bmp". See <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-buffer" title="gdk_pixbuf_save_to_buffer ()"><code class="function">gdk_pixbuf_save_to_buffer()</code></a> for more details.</p> <p>The <em class="parameter"><code>cancellable</code></em> can be used to abort the operation from another thread. If the operation was cancelled, the error <code class="literal">G_IO_ERROR_CANCELLED</code> will be returned. Other possible errors are in the <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> and <a href="http://library.gnome.org/devel/gio/unstable/gio-GIOError.html#G-IO-ERROR:CAPS"><code class="literal">G_IO_ERROR</code></a> domains. </p> <p>The stream is not closed.</p> <div class="refsect3"> <a name="id-1.2.7.6.9.8"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>pixbuf</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a href="http://library.gnome.org/devel/gio/unstable/GOutputStream.html"><span class="type">GOutputStream</span></a> to save the pixbuf to</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>type</p></td> <td class="parameter_description"><p>name of file format</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p> optional <a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> object, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p> return location for error, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>...</p></td> <td class="parameter_description"><p>list of key-value save options</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.2.7.6.9.9"></a><h4>Returns</h4> <p> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the pixbuf was saved successfully, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if an error was set.</p> <p></p> </div> <p class="since">Since 2.14</p> </div> <hr> <div class="refsect2"> <a name="gdk-pixbuf-save-to-stream-async"></a><h3>gdk_pixbuf_save_to_stream_async ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> gdk_pixbuf_save_to_stream_async (<em class="parameter"><code><a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> *pixbuf</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GOutputStream.html"><span class="type">GOutputStream</span></a> *stream</code></em>, <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *type</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> *cancellable</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GAsyncResult.html#GAsyncReadyCallback"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>, <em class="parameter"><code>...</code></em>);</pre> <p>Saves <em class="parameter"><code>pixbuf</code></em> to an output stream asynchronously.</p> <p>For more details see <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-stream" title="gdk_pixbuf_save_to_stream ()"><code class="function">gdk_pixbuf_save_to_stream()</code></a>, which is the synchronous version of this function.</p> <p>When the operation is finished, <em class="parameter"><code>callback</code></em> will be called in the main thread. You can then call <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-stream-finish" title="gdk_pixbuf_save_to_stream_finish ()"><code class="function">gdk_pixbuf_save_to_stream_finish()</code></a> to get the result of the operation.</p> <div class="refsect3"> <a name="id-1.2.7.6.10.7"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>pixbuf</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>stream</p></td> <td class="parameter_description"><p>a <a href="http://library.gnome.org/devel/gio/unstable/GOutputStream.html"><span class="type">GOutputStream</span></a> to which to save the pixbuf</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>type</p></td> <td class="parameter_description"><p>name of file format</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cancellable</p></td> <td class="parameter_description"><p> optional <a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> object, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>callback</p></td> <td class="parameter_description"><p>a <a href="http://library.gnome.org/devel/gio/unstable/GAsyncResult.html#GAsyncReadyCallback"><span class="type">GAsyncReadyCallback</span></a> to call when the the pixbuf is loaded</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>user_data</p></td> <td class="parameter_description"><p>the data to pass to the callback function</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>...</p></td> <td class="parameter_description"><p>list of key-value save options</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <p class="since">Since 2.24</p> </div> <hr> <div class="refsect2"> <a name="gdk-pixbuf-save-to-stream-finish"></a><h3>gdk_pixbuf_save_to_stream_finish ()</h3> <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gdk_pixbuf_save_to_stream_finish (<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GAsyncResult.html"><span class="type">GAsyncResult</span></a> *async_result</code></em>, <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre> <p>Finishes an asynchronous pixbuf save operation started with <a class="link" href="gdk-pixbuf-File-saving.html#gdk-pixbuf-save-to-stream-async" title="gdk_pixbuf_save_to_stream_async ()"><code class="function">gdk_pixbuf_save_to_stream_async()</code></a>.</p> <div class="refsect3"> <a name="id-1.2.7.6.11.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>async_result</p></td> <td class="parameter_description"><p>a <a href="http://library.gnome.org/devel/gio/unstable/GAsyncResult.html"><span class="type">GAsyncResult</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>a <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.2.7.6.11.6"></a><h4>Returns</h4> <p> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the pixbuf was saved successfully, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if an error was set.</p> <p></p> </div> <p class="since">Since 2.24</p> </div> </div> <div class="refsect1"> <a name="gdk-pixbuf-File-saving.other_details"></a><h2>Types and Values</h2> </div> </div> <div class="footer"> <hr> Generated by GTK-Doc V1.20.1</div> </body> </html>