<refentry id="gdk-pixbuf-file-loading">
<refmeta>
<refentrytitle>File Loading</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GDK-PIXBUF Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>File Loading</refname><refpurpose>Loading a pixbuf from a file.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>

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


<link linkend="GdkPixbuf">GdkPixbuf</link>*  <link linkend="gdk-pixbuf-new-from-file">gdk_pixbuf_new_from_file</link>        (const char *filename,
                                             <link linkend="GError">GError</link> **error);
</synopsis>
</refsynopsisdiv>





<refsect1>
<title>Description</title>
  <para>
    The &gdk-pixbuf; library provides a simple mechanism for loading
    an image from a file in synchronous fashion.  This means that the
    library takes control of the application while the file is being
    loaded; from the user's point of view, the application will block
    until the image is done loading.
  </para>

  <para>
    This interface can be used by applications in which blocking is
    acceptable while an image is being loaded.  It can also be used to
    load small images in general.  Applications that need progressive
    loading can use the <link linkend="GdkPixbufLoader">GdkPixbufLoader</link> functionality instead.
  </para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="gdk-pixbuf-new-from-file">gdk_pixbuf_new_from_file ()</title>
<programlisting><link linkend="GdkPixbuf">GdkPixbuf</link>*  gdk_pixbuf_new_from_file        (const char *filename,
                                             <link linkend="GError">GError</link> **error);</programlisting>
<para>
Creates a new pixbuf by loading an image from a file.  The file format is
detected automatically. If <literal>NULL</literal> is returned, then <parameter>error</parameter> will be set.
Possible errors are in the <link linkend="GDK-PIXBUF-ERROR-CAPS">GDK_PIXBUF_ERROR</link> and <link linkend="G-FILE-ERROR-CAPS">G_FILE_ERROR</link> domains.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>filename</parameter>&nbsp;:</entry>
<entry> Name of file to load.
</entry></row>
<row><entry align="right"><parameter>error</parameter>&nbsp;:</entry>
<entry> Return location for an error
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> A newly-created pixbuf with a reference count of 1, or <literal>NULL</literal> if
any of several error conditions occurred:  the file could not be opened,
there was no loader for the file's format, there was not enough memory to
allocate the image buffer, or the image file contained invalid data.
</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>



<refsect1>
<title>See Also</title>
  <para>
    <link linkend="GdkPixbufLoader">GdkPixbufLoader</link>.
  </para>
</refsect1>

</refentry>
