1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>File Loading</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7
<link rel="home" href="index.html" title="GDK-PixBuf Reference Manual">
8
<link rel="up" href="rn01.html" title="API Reference">
9
<link rel="prev" href="gdk-pixbuf-refcounting.html" title="Reference Counting and Memory Mangement">
10
<link rel="next" href="gdk-pixbuf-file-saving.html" title="File saving">
11
<meta name="generator" content="GTK-Doc V1.15 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
17
<td><a accesskey="p" href="gdk-pixbuf-refcounting.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18
<td><a accesskey="u" href="rn01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20
<th width="100%" align="center">GDK-PixBuf Reference Manual</th>
21
<td><a accesskey="n" href="gdk-pixbuf-file-saving.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
23
<tr><td colspan="5" class="shortcuts">
24
<a href="#gdk-pixbuf-file-loading.synopsis" class="shortcut">Top</a>
26
<a href="#gdk-pixbuf-file-loading.description" class="shortcut">Description</a>
29
<div class="refentry" title="File Loading">
30
<a name="gdk-pixbuf-file-loading"></a><div class="titlepage"></div>
31
<div class="refnamediv"><table width="100%"><tr>
33
<h2><span class="refentrytitle"><a name="gdk-pixbuf-file-loading.top_of_page"></a>File Loading</span></h2>
34
<p>File Loading — Loading a pixbuf from a file.</p>
36
<td valign="top" align="right"></td>
38
<div class="refsynopsisdiv" title="Synopsis">
39
<a name="gdk-pixbuf-file-loading.synopsis"></a><h2>Synopsis</h2>
40
<pre class="synopsis">
41
#include <gdk-pixbuf/gdk-pixbuf.h>
43
<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> * <a class="link" href="gdk-pixbuf-file-loading.html#gdk-pixbuf-new-from-file" title="gdk_pixbuf_new_from_file ()">gdk_pixbuf_new_from_file</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
44
<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>);
45
<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> * <a class="link" href="gdk-pixbuf-file-loading.html#gdk-pixbuf-new-from-file-at-size" title="gdk_pixbuf_new_from_file_at_size ()">gdk_pixbuf_new_from_file_at_size</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
46
<em class="parameter"><code><span class="type">int</span> width</code></em>,
47
<em class="parameter"><code><span class="type">int</span> height</code></em>,
48
<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>);
49
<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> * <a class="link" href="gdk-pixbuf-file-loading.html#gdk-pixbuf-new-from-file-at-scale" title="gdk_pixbuf_new_from_file_at_scale ()">gdk_pixbuf_new_from_file_at_scale</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
50
<em class="parameter"><code><span class="type">int</span> width</code></em>,
51
<em class="parameter"><code><span class="type">int</span> height</code></em>,
52
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> preserve_aspect_ratio</code></em>,
53
<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>);
54
<a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" title="GdkPixbufFormat"><span class="returnvalue">GdkPixbufFormat</span></a> * <a class="link" href="gdk-pixbuf-file-loading.html#gdk-pixbuf-get-file-info" title="gdk_pixbuf_get_file_info ()">gdk_pixbuf_get_file_info</a> (<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> *filename</code></em>,
55
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *width</code></em>,
56
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *height</code></em>);
57
<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> * <a class="link" href="gdk-pixbuf-file-loading.html#gdk-pixbuf-new-from-stream" title="gdk_pixbuf_new_from_stream ()">gdk_pixbuf_new_from_stream</a> (<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GInputStream.html"><span class="type">GInputStream</span></a> *stream</code></em>,
58
<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> *cancellable</code></em>,
59
<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>);
60
<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> * <a class="link" href="gdk-pixbuf-file-loading.html#gdk-pixbuf-new-from-stream-at-scale" title="gdk_pixbuf_new_from_stream_at_scale ()">gdk_pixbuf_new_from_stream_at_scale</a> (<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GInputStream.html"><span class="type">GInputStream</span></a> *stream</code></em>,
61
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
62
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>,
63
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> preserve_aspect_ratio</code></em>,
64
<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> *cancellable</code></em>,
65
<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>);
68
<div class="refsect1" title="Description">
69
<a name="gdk-pixbuf-file-loading.description"></a><h2>Description</h2>
71
The <span class="application">gdk-pixbuf</span> library provides a simple mechanism for loading
72
an image from a file in synchronous fashion. This means that the
73
library takes control of the application while the file is being
74
loaded; from the user's point of view, the application will block
75
until the image is done loading.
78
This interface can be used by applications in which blocking is
79
acceptable while an image is being loaded. It can also be used to
80
load small images in general. Applications that need progressive
81
loading can use the <a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a> functionality instead.
84
<div class="refsect1" title="Details">
85
<a name="gdk-pixbuf-file-loading.details"></a><h2>Details</h2>
86
<div class="refsect2" title="gdk_pixbuf_new_from_file ()">
87
<a name="gdk-pixbuf-new-from-file"></a><h3>gdk_pixbuf_new_from_file ()</h3>
88
<pre class="programlisting"><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> * gdk_pixbuf_new_from_file (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
89
<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>
91
Creates a new pixbuf by loading an image from a file. The file format is
92
detected automatically. If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned, then <em class="parameter"><code>error</code></em> will be set.
93
Possible errors are in the <a class="link" href="gdk-pixbuf-gdk-pixbuf.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/glib/unstable/glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a> domains.
95
<div class="variablelist"><table border="0">
96
<col align="left" valign="top">
99
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
100
<td>Name of file to load, in the GLib file name encoding
104
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
105
<td>Return location for an error
109
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
110
<td> A newly-created pixbuf with a reference count of 1, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if
111
any of several error conditions occurred: the file could not be opened,
112
there was no loader for the file's format, there was not enough memory to
113
allocate the image buffer, or the image file contained invalid data.
120
<div class="refsect2" title="gdk_pixbuf_new_from_file_at_size ()">
121
<a name="gdk-pixbuf-new-from-file-at-size"></a><h3>gdk_pixbuf_new_from_file_at_size ()</h3>
122
<pre class="programlisting"><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> * gdk_pixbuf_new_from_file_at_size (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
123
<em class="parameter"><code><span class="type">int</span> width</code></em>,
124
<em class="parameter"><code><span class="type">int</span> height</code></em>,
125
<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>
127
Creates a new pixbuf by loading an image from a file.
128
The file format is detected automatically. If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned, then
129
<em class="parameter"><code>error</code></em> will be set. Possible errors are in the <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ERROR:CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> and
130
<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> domains.
133
The image will be scaled to fit in the requested size, preserving
134
the image's aspect ratio. Note that the returned pixbuf may be smaller
135
than <em class="parameter"><code>width</code></em> x <em class="parameter"><code>height</code></em>, if the aspect ratio requires it. To load
136
and image at the requested size, regardless of aspect ratio, use
137
<a class="link" href="gdk-pixbuf-file-loading.html#gdk-pixbuf-new-from-file-at-scale" title="gdk_pixbuf_new_from_file_at_scale ()"><code class="function">gdk_pixbuf_new_from_file_at_scale()</code></a>.
139
<div class="variablelist"><table border="0">
140
<col align="left" valign="top">
143
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
144
<td>Name of file to load, in the GLib file name encoding
148
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
149
<td>The width the image should have or -1 to not constrain the width
153
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
154
<td>The height the image should have or -1 to not constrain the height
158
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
159
<td>Return location for an error
163
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
164
<td> A newly-created pixbuf with a reference count of 1, or
165
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if any of several error conditions occurred: the file could not
166
be opened, there was no loader for the file's format, there was not
167
enough memory to allocate the image buffer, or the image file contained
174
<p class="since">Since 2.4</p>
177
<div class="refsect2" title="gdk_pixbuf_new_from_file_at_scale ()">
178
<a name="gdk-pixbuf-new-from-file-at-scale"></a><h3>gdk_pixbuf_new_from_file_at_scale ()</h3>
179
<pre class="programlisting"><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> * gdk_pixbuf_new_from_file_at_scale (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
180
<em class="parameter"><code><span class="type">int</span> width</code></em>,
181
<em class="parameter"><code><span class="type">int</span> height</code></em>,
182
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> preserve_aspect_ratio</code></em>,
183
<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>
185
Creates a new pixbuf by loading an image from a file. The file format is
186
detected automatically. If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned, then <em class="parameter"><code>error</code></em> will be set.
187
Possible errors are in the <a class="link" href="gdk-pixbuf-gdk-pixbuf.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/glib/unstable/glib-File-Utilities.html#G-FILE-ERROR:CAPS"><span class="type">G_FILE_ERROR</span></a> domains.
188
The image will be scaled to fit in the requested size, optionally preserving
189
the image's aspect ratio.
192
When preserving the aspect ratio, a <em class="parameter"><code>width</code></em> of -1 will cause the image
193
to be scaled to the exact given height, and a <em class="parameter"><code>height</code></em> of -1 will cause
194
the image to be scaled to the exact given width. When not preserving
195
aspect ratio, a <em class="parameter"><code>width</code></em> or <em class="parameter"><code>height</code></em> of -1 means to not scale the image
196
at all in that dimension. Negative values for <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> are
199
<div class="variablelist"><table border="0">
200
<col align="left" valign="top">
203
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
204
<td>Name of file to load, in the GLib file name encoding
208
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
209
<td>The width the image should have or -1 to not constrain the width
213
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
214
<td>The height the image should have or -1 to not constrain the height
218
<td><p><span class="term"><em class="parameter"><code>preserve_aspect_ratio</code></em> :</span></p></td>
220
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to preserve the image's aspect ratio
224
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
225
<td>Return location for an error
229
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
230
<td> A newly-created pixbuf with a reference count of 1, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
231
if any of several error conditions occurred: the file could not be opened,
232
there was no loader for the file's format, there was not enough memory to
233
allocate the image buffer, or the image file contained invalid data.
239
<p class="since">Since 2.6</p>
242
<div class="refsect2" title="gdk_pixbuf_get_file_info ()">
243
<a name="gdk-pixbuf-get-file-info"></a><h3>gdk_pixbuf_get_file_info ()</h3>
244
<pre class="programlisting"><a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" title="GdkPixbufFormat"><span class="returnvalue">GdkPixbufFormat</span></a> * gdk_pixbuf_get_file_info (<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> *filename</code></em>,
245
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *width</code></em>,
246
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *height</code></em>);</pre>
248
Parses an image file far enough to determine its format and size.
250
<div class="variablelist"><table border="0">
251
<col align="left" valign="top">
254
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
255
<td>The name of the file to identify.
259
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
260
<td>Return location for the width of the image, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
264
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
265
<td>Return location for the height of the image, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
269
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
270
<td> A <a class="link" href="gdk-pixbuf-Module-Interface.html#GdkPixbufFormat" title="GdkPixbufFormat"><span class="type">GdkPixbufFormat</span></a> describing the image format of the file
271
or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the image format wasn't recognized. The return value
272
is owned by GdkPixbuf and should not be freed.
278
<p class="since">Since 2.4</p>
281
<div class="refsect2" title="gdk_pixbuf_new_from_stream ()">
282
<a name="gdk-pixbuf-new-from-stream"></a><h3>gdk_pixbuf_new_from_stream ()</h3>
283
<pre class="programlisting"><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> * gdk_pixbuf_new_from_stream (<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GInputStream.html"><span class="type">GInputStream</span></a> *stream</code></em>,
284
<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> *cancellable</code></em>,
285
<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>
287
Creates a new pixbuf by loading an image from an input stream.
290
The file format is detected automatically. If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned, then
291
<em class="parameter"><code>error</code></em> will be set. The <em class="parameter"><code>cancellable</code></em> can be used to abort the operation
292
from another thread. If the operation was cancelled, the error
293
<code class="literal">GIO_ERROR_CANCELLED</code> will be returned. Other possible errors are in
294
the <a class="link" href="gdk-pixbuf-gdk-pixbuf.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.
297
The stream is not closed.
299
<div class="variablelist"><table border="0">
300
<col align="left" valign="top">
303
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
304
<td>a <a href="http://library.gnome.org/devel/gio/unstable/GInputStream.html"><span class="type">GInputStream</span></a> to load the pixbuf from
308
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
309
<td>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
313
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
314
<td>Return location for an error
318
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
319
<td> A newly-created pixbuf, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if any of several error
320
conditions occurred: the file could not be opened, the image format is
321
not supported, there was not enough memory to allocate the image buffer,
322
the stream contained invalid data, or the operation was cancelled.
328
<p class="since">Since 2.14</p>
331
<div class="refsect2" title="gdk_pixbuf_new_from_stream_at_scale ()">
332
<a name="gdk-pixbuf-new-from-stream-at-scale"></a><h3>gdk_pixbuf_new_from_stream_at_scale ()</h3>
333
<pre class="programlisting"><a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="returnvalue">GdkPixbuf</span></a> * gdk_pixbuf_new_from_stream_at_scale (<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GInputStream.html"><span class="type">GInputStream</span></a> *stream</code></em>,
334
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> width</code></em>,
335
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> height</code></em>,
336
<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> preserve_aspect_ratio</code></em>,
337
<em class="parameter"><code><a href="http://library.gnome.org/devel/gio/unstable/GCancellable.html"><span class="type">GCancellable</span></a> *cancellable</code></em>,
338
<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>
340
Creates a new pixbuf by loading an image from an input stream.
343
The file format is detected automatically. If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned, then
344
<em class="parameter"><code>error</code></em> will be set. The <em class="parameter"><code>cancellable</code></em> can be used to abort the operation
345
from another thread. If the operation was cancelled, the error
346
<code class="literal">GIO_ERROR_CANCELLED</code> will be returned. Other possible errors are in
347
the <a class="link" href="gdk-pixbuf-gdk-pixbuf.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.
350
The image will be scaled to fit in the requested size, optionally
351
preserving the image's aspect ratio. When preserving the aspect ratio,
352
a <em class="parameter"><code>width</code></em> of -1 will cause the image to be scaled to the exact given
353
height, and a <em class="parameter"><code>height</code></em> of -1 will cause the image to be scaled to the
354
exact given width. When not preserving aspect ratio, a <em class="parameter"><code>width</code></em> or
355
<em class="parameter"><code>height</code></em> of -1 means to not scale the image at all in that dimension.
358
The stream is not closed.
360
<div class="variablelist"><table border="0">
361
<col align="left" valign="top">
364
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
365
<td>a <a href="http://library.gnome.org/devel/gio/unstable/GInputStream.html"><span class="type">GInputStream</span></a> to load the pixbuf from
369
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
370
<td>The width the image should have or -1 to not constrain the width
374
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
375
<td>The height the image should have or -1 to not constrain the height
379
<td><p><span class="term"><em class="parameter"><code>preserve_aspect_ratio</code></em> :</span></p></td>
381
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to preserve the image's aspect ratio
385
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
386
<td>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
390
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
391
<td>Return location for an error
395
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
396
<td> A newly-created pixbuf, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if any of several error
397
conditions occurred: the file could not be opened, the image format is
398
not supported, there was not enough memory to allocate the image buffer,
399
the stream contained invalid data, or the operation was cancelled.
405
<p class="since">Since 2.14</p>
408
<div class="refsect1" title="See Also">
409
<a name="gdk-pixbuf-file-loading.see-also"></a><h2>See Also</h2>
411
<a class="link" href="GdkPixbufLoader.html" title="GdkPixbufLoader"><span class="type">GdkPixbufLoader</span></a>.
417
Generated by GTK-Doc V1.15</div>
b'\\ No newline at end of file'