~ubuntu-branches/ubuntu/saucy/vips/saucy

« back to all changes in this revision

Viewing changes to doc/reference/html/VipsFormat.html

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2012-03-18 16:54:58 UTC
  • mfrom: (1.1.17) (30.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20120318165458-6okio21v96g3bd7t
Tags: 7.28.2-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
 
<html>
3
 
<head>
4
 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
 
<title>VipsFormat</title>
6
 
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7
 
<link rel="home" href="index.html" title="VIPS Reference Manual">
8
 
<link rel="up" href="ch02.html" title="VIPS operation API by section">
9
 
<link rel="prev" href="libvips-convolution.html" title="convolution">
10
 
<link rel="next" href="libvips-freq-filt.html" title="freq_filt">
11
 
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
12
 
<link rel="stylesheet" href="style.css" type="text/css">
13
 
</head>
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">
16
 
<tr valign="middle">
17
 
<td><a accesskey="p" href="libvips-convolution.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18
 
<td><a accesskey="u" href="ch02.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">VIPS Reference Manual</th>
21
 
<td><a accesskey="n" href="libvips-freq-filt.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22
 
</tr>
23
 
<tr><td colspan="5" class="shortcuts">
24
 
<a href="#VipsFormat.synopsis" class="shortcut">Top</a>
25
 
                   | 
26
 
                  <a href="#VipsFormat.description" class="shortcut">Description</a>
27
 
                   | 
28
 
                  <a href="#VipsFormat.object-hierarchy" class="shortcut">Object Hierarchy</a>
29
 
</td></tr>
30
 
</table>
31
 
<div class="refentry">
32
 
<a name="VipsFormat"></a><div class="titlepage"></div>
33
 
<div class="refnamediv"><table width="100%"><tr>
34
 
<td valign="top">
35
 
<h2><span class="refentrytitle"><a name="VipsFormat.top_of_page"></a>VipsFormat</span></h2>
36
 
<p>VipsFormat — load and save in a variety of formats</p>
37
 
</td>
38
 
<td valign="top" align="right"></td>
39
 
</tr></table></div>
40
 
<div class="refsect1">
41
 
<a name="VipsFormat.stability-level"></a><h2>Stability Level</h2>
42
 
Stable, unless otherwise indicated
43
 
</div>
44
 
<div class="refsynopsisdiv">
45
 
<a name="VipsFormat.synopsis"></a><h2>Synopsis</h2>
46
 
<pre class="synopsis">
47
 
#include &lt;vips/vips.h&gt;
48
 
 
49
 
enum                <a class="link" href="VipsFormat.html#VipsFormatFlags" title="enum VipsFormatFlags">VipsFormatFlags</a>;
50
 
                    <a class="link" href="VipsFormat.html#VipsFormat-struct" title="VipsFormat">VipsFormat</a>;
51
 
                    <a class="link" href="VipsFormat.html#VipsFormatClass" title="VipsFormatClass">VipsFormatClass</a>;
52
 
<span class="returnvalue">void</span> *              <a class="link" href="VipsFormat.html#vips-format-map" title="vips_format_map ()">vips_format_map</a>                     (<em class="parameter"><code><a class="link" href="libvips-util.html#VipsSListMap2Fn" title="VipsSListMap2Fn ()"><span class="type">VipsSListMap2Fn</span></a> fn</code></em>,
53
 
                                                         <em class="parameter"><code><span class="type">void</span> *a</code></em>,
54
 
                                                         <em class="parameter"><code><span class="type">void</span> *b</code></em>);
55
 
<a class="link" href="VipsFormat.html#VipsFormatClass" title="VipsFormatClass"><span class="returnvalue">VipsFormatClass</span></a> *   <a class="link" href="VipsFormat.html#vips-format-for-file" title="vips_format_for_file ()">vips_format_for_file</a>                (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
56
 
<a class="link" href="VipsFormat.html#VipsFormatClass" title="VipsFormatClass"><span class="returnvalue">VipsFormatClass</span></a> *   <a class="link" href="VipsFormat.html#vips-format-for-name" title="vips_format_for_name ()">vips_format_for_name</a>                (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
57
 
<a class="link" href="VipsFormat.html#VipsFormatFlags" title="enum VipsFormatFlags"><span class="returnvalue">VipsFormatFlags</span></a>     <a class="link" href="VipsFormat.html#vips-format-get-flags" title="vips_format_get_flags ()">vips_format_get_flags</a>               (<em class="parameter"><code><a class="link" href="VipsFormat.html#VipsFormatClass" title="VipsFormatClass"><span class="type">VipsFormatClass</span></a> *format</code></em>,
58
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
59
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#vips-format-read" title="vips_format_read ()">vips_format_read</a>                    (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
60
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
61
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#vips-format-write" title="vips_format_write ()">vips_format_write</a>                   (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
62
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
63
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-jpeg2vips" title="im_jpeg2vips ()">im_jpeg2vips</a>                        (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
64
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
65
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-bufjpeg2vips" title="im_bufjpeg2vips ()">im_bufjpeg2vips</a>                     (<em class="parameter"><code><span class="type">void</span> *buf</code></em>,
66
 
                                                         <em class="parameter"><code><span class="type">size_t</span> len</code></em>,
67
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
68
 
                                                         <em class="parameter"><code><span class="type">gboolean</span> header_only</code></em>);
69
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-vips2jpeg" title="im_vips2jpeg ()">im_vips2jpeg</a>                        (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
70
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
71
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-vips2mimejpeg" title="im_vips2mimejpeg ()">im_vips2mimejpeg</a>                    (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
72
 
                                                         <em class="parameter"><code><span class="type">int</span> qfac</code></em>);
73
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-vips2bufjpeg" title="im_vips2bufjpeg ()">im_vips2bufjpeg</a>                     (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
74
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
75
 
                                                         <em class="parameter"><code><span class="type">int</span> qfac</code></em>,
76
 
                                                         <em class="parameter"><code><span class="type">char</span> **obuf</code></em>,
77
 
                                                         <em class="parameter"><code><span class="type">int</span> *olen</code></em>);
78
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-tiff2vips" title="im_tiff2vips ()">im_tiff2vips</a>                        (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
79
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
80
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-vips2tiff" title="im_vips2tiff ()">im_vips2tiff</a>                        (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
81
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
82
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-tile-cache" title="im_tile_cache ()">im_tile_cache</a>                       (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
83
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
84
 
                                                         <em class="parameter"><code><span class="type">int</span> tile_width</code></em>,
85
 
                                                         <em class="parameter"><code><span class="type">int</span> tile_height</code></em>,
86
 
                                                         <em class="parameter"><code><span class="type">int</span> max_tiles</code></em>);
87
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-magick2vips" title="im_magick2vips ()">im_magick2vips</a>                      (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
88
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
89
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-exr2vips" title="im_exr2vips ()">im_exr2vips</a>                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
90
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
91
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-ppm2vips" title="im_ppm2vips ()">im_ppm2vips</a>                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
92
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
93
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-vips2ppm" title="im_vips2ppm ()">im_vips2ppm</a>                         (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
94
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
95
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-analyze2vips" title="im_analyze2vips ()">im_analyze2vips</a>                     (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
96
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
97
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-csv2vips" title="im_csv2vips ()">im_csv2vips</a>                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
98
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
99
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-vips2csv" title="im_vips2csv ()">im_vips2csv</a>                         (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
100
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
101
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-png2vips" title="im_png2vips ()">im_png2vips</a>                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
102
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
103
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-vips2png" title="im_vips2png ()">im_vips2png</a>                         (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
104
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
105
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-vips2bufpng" title="im_vips2bufpng ()">im_vips2bufpng</a>                      (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
106
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
107
 
                                                         <em class="parameter"><code><span class="type">int</span> compression</code></em>,
108
 
                                                         <em class="parameter"><code><span class="type">int</span> interlace</code></em>,
109
 
                                                         <em class="parameter"><code><span class="type">char</span> **obuf</code></em>,
110
 
                                                         <em class="parameter"><code><span class="type">size_t</span> *olen</code></em>);
111
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-raw2vips" title="im_raw2vips ()">im_raw2vips</a>                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
112
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
113
 
                                                         <em class="parameter"><code><span class="type">int</span> width</code></em>,
114
 
                                                         <em class="parameter"><code><span class="type">int</span> height</code></em>,
115
 
                                                         <em class="parameter"><code><span class="type">int</span> bpp</code></em>,
116
 
                                                         <em class="parameter"><code><span class="type">int</span> offset</code></em>);
117
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-vips2raw" title="im_vips2raw ()">im_vips2raw</a>                         (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
118
 
                                                         <em class="parameter"><code><span class="type">int</span> fd</code></em>);
119
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-mat2vips" title="im_mat2vips ()">im_mat2vips</a>                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
120
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
121
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-rad2vips" title="im_rad2vips ()">im_rad2vips</a>                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
122
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
123
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-vips2rad" title="im_vips2rad ()">im_vips2rad</a>                         (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
124
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
125
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-fits2vips" title="im_fits2vips ()">im_fits2vips</a>                        (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
126
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
127
 
<span class="returnvalue">int</span>                 <a class="link" href="VipsFormat.html#im-vips2fits" title="im_vips2fits ()">im_vips2fits</a>                        (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
128
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
129
 
</pre>
130
 
</div>
131
 
<div class="refsect1">
132
 
<a name="VipsFormat.object-hierarchy"></a><h2>Object Hierarchy</h2>
133
 
<pre class="synopsis">
134
 
  GObject
135
 
   +----<a class="link" href="libvips-VipsArgument.html#VipsObject">VipsObject</a>
136
 
         +----VipsFormat
137
 
</pre>
138
 
</div>
139
 
<div class="refsect1">
140
 
<a name="VipsFormat.description"></a><h2>Description</h2>
141
 
<p>
142
 
VIPS has a simple system for representing image load and save operations in
143
 
a generic way.
144
 
You can ask for a loader for a certain file or select a saver based on a
145
 
filename. Once you have found a format, you can use it to load a file of
146
 
that type, save an image to a file of that type, query files for their type
147
 
and fields, and ask for supported features. You can also call the
148
 
converters directly, if you like. 
149
 
</p>
150
 
<p>
151
 
If you define a new format, support for
152
 
it automatically appears in all VIPS user-interfaces. It will also be
153
 
transparently supported by <code class="function">im_open()</code>.
154
 
</p>
155
 
<p>
156
 
VIPS comes with VipsFormat for TIFF, JPEG, PNG, Analyze, PPM, OpenEXR, CSV,
157
 
Matlab, Radiance, RAW, VIPS and one that wraps libMagick.
158
 
</p>
159
 
</div>
160
 
<div class="refsect1">
161
 
<a name="VipsFormat.details"></a><h2>Details</h2>
162
 
<div class="refsect2">
163
 
<a name="VipsFormatFlags"></a><h3>enum VipsFormatFlags</h3>
164
 
<pre class="programlisting">typedef enum {
165
 
        VIPS_FORMAT_NONE = 0,           /* No flags set */
166
 
        VIPS_FORMAT_PARTIAL = 1, /* Lazy read OK (eg. tiled tiff) */
167
 
        VIPS_FORMAT_BIGENDIAN = 2 /* Most-significant byte first */
168
 
} VipsFormatFlags;
169
 
</pre>
170
 
<p>
171
 
Some hints about the image loader.
172
 
</p>
173
 
<p>
174
 
<em class="parameter"><code>VIPS_FORMAT_PARTIAL</code></em> means that the image can be read directly from the
175
 
file without needing to be unpacked to a temporary image first. 
176
 
</p>
177
 
<p>
178
 
<em class="parameter"><code>VIPS_FORMAT_BIGENDIAN</code></em> means that image pixels are most-significant byte
179
 
first. Depending on the native byte order of the host machine, you may
180
 
need to swap bytes. See <a class="link" href="libvips-conversion.html#im-copy-swap" title="im_copy_swap ()"><code class="function">im_copy_swap()</code></a>.
181
 
</p>
182
 
<div class="variablelist"><table border="0">
183
 
<col align="left" valign="top">
184
 
<tbody>
185
 
<tr>
186
 
<td><p><a name="VIPS-FORMAT-NONE:CAPS"></a><span class="term"><code class="literal">VIPS_FORMAT_NONE</code></span></p></td>
187
 
<td>no flags set
188
 
</td>
189
 
</tr>
190
 
<tr>
191
 
<td><p><a name="VIPS-FORMAT-PARTIAL:CAPS"></a><span class="term"><code class="literal">VIPS_FORMAT_PARTIAL</code></span></p></td>
192
 
<td>the image may be read lazilly
193
 
</td>
194
 
</tr>
195
 
<tr>
196
 
<td><p><a name="VIPS-FORMAT-BIGENDIAN:CAPS"></a><span class="term"><code class="literal">VIPS_FORMAT_BIGENDIAN</code></span></p></td>
197
 
<td>image pixels are most-significant byte first
198
 
</td>
199
 
</tr>
200
 
</tbody>
201
 
</table></div>
202
 
</div>
203
 
<hr>
204
 
<div class="refsect2">
205
 
<a name="VipsFormat-struct"></a><h3>VipsFormat</h3>
206
 
<pre class="programlisting">typedef struct _VipsFormat VipsFormat;</pre>
207
 
<p>
208
 
Actually, we never make <a class="link" href="VipsFormat.html" title="VipsFormat"><code class="literal">VipsFormat</code></a> objects, we just use virtual methods on
209
 
the class object. It is defined as:
210
 
</p>
211
 
<p>
212
 
</p>
213
 
<div class="informalexample"><pre class="programlisting">
214
 
typedef struct _VipsFormatClass {
215
 
  VipsObjectClass parent_class;
216
 
 
217
 
  gboolean (*is_a)( const char *filename );
218
 
  int (*header)( const char *filename, IMAGE *out );
219
 
  int (*load)( const char *filename, IMAGE *out );
220
 
  int (*save)( IMAGE *in, const char *filename );
221
 
  VipsFormatFlags (*get_flags)( const char *filename );
222
 
  int priority;
223
 
  const char **suffs;
224
 
} VipsFormatClass;
225
 
</pre></div>
226
 
<p>
227
 
</p>
228
 
<p>
229
 
Add a new format to VIPS by subclassing VipsFormat. Subclasses need to 
230
 
implement at least <code class="function">load()</code> or <code class="function">save()</code>. 
231
 
</p>
232
 
<p>
233
 
These members are:
234
 
</p>
235
 
<p>
236
 
</p>
237
 
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
238
 
<li class="listitem"><p>
239
 
<code class="function">is_a()</code> This function should return <code class="literal">TRUE</code> if the file 
240
 
contains an image of this type. If you don't define this function, VIPS
241
 
will use the list of suffixes you supply instead.
242
 
    </p></li>
243
 
<li class="listitem"><p>
244
 
<code class="function">header()</code> This function should load the image header,
245
 
but not load any pixel data. If you don't define it, VIPS will use your
246
 
<code class="function">load()</code> method instead. Return 0 for success, -1 for error, setting
247
 
<code class="function">im_error()</code>.
248
 
    </p></li>
249
 
<li class="listitem"><p>
250
 
<code class="function">load()</code> This function should load the image, or perhaps use <code class="function">im_generate()</code> to
251
 
attach something to load sections of the image on demand. 
252
 
Users can embed
253
 
load options in the filename, see (for example) <a class="link" href="VipsFormat.html#im-jpeg2vips" title="im_jpeg2vips ()"><code class="function">im_jpeg2vips()</code></a>.
254
 
If you don't
255
 
define this method, you can still define <code class="function">save()</code> and have a save-only
256
 
format.
257
 
Return 0 for success, -1 for error, setting
258
 
<code class="function">im_error()</code>.
259
 
    </p></li>
260
 
<li class="listitem"><p>
261
 
<code class="function">save()</code> This function should save the image to the file. 
262
 
Users can embed
263
 
save options in the filename, see (for example) <a class="link" href="VipsFormat.html#im-vips2tiff" title="im_vips2tiff ()"><code class="function">im_vips2tiff()</code></a>.
264
 
If you don't
265
 
define this method, you can still define <code class="function">load()</code> and have a load-only
266
 
format.
267
 
Return 0 for success, -1 for error, setting
268
 
<code class="function">im_error()</code>.
269
 
    </p></li>
270
 
<li class="listitem"><p>
271
 
<code class="function">get_flags()</code> This function should return a hint about the properties of this
272
 
loader on this file. If you don't define it, users will always see '0', or
273
 
no flags. 
274
 
    </p></li>
275
 
<li class="listitem"><p>
276
 
<em class="structfield"><code>priority</code></em> Where this format should fit in this 
277
 
list of
278
 
supported formats. 0 is a sensible value for most formats. Set a negative
279
 
value if you want to be lower on the list, positive to move up.
280
 
    </p></li>
281
 
<li class="listitem">
282
 
<p>
283
 
<em class="structfield"><code>suffs</code></em> A <code class="literal">NULL</code>-terminated list of possible file 
284
 
name
285
 
suffixes, for example:
286
 
</p>
287
 
<div class="informalexample"><pre class="programlisting">
288
 
static const char *tiff_suffs[] = { ".tif", ".tiff", NULL };
289
 
</pre></div>
290
 
<p>
291
 
The suffix list is used to select a format to save a file in, and to pick a
292
 
loader if you don't define <code class="function">is_a()</code>.
293
 
    </p>
294
 
</li>
295
 
</ul></div>
296
 
<p>
297
 
</p>
298
 
<p>
299
 
You should also define <em class="structfield"><code>nickname</code></em> and
300
 
<em class="structfield"><code>description</code></em> in <a class="link" href="libvips-VipsArgument.html#VipsObject"><span class="type">VipsObject</span></a>. 
301
 
</p>
302
 
<p>
303
 
At the command-line, use:
304
 
</p>
305
 
<p>
306
 
</p>
307
 
<div class="informalexample"><pre class="programlisting">
308
 
vips --list classes | grep Format
309
 
</pre></div>
310
 
<p>
311
 
</p>
312
 
<p>
313
 
To see a list of all the supported formats.
314
 
</p>
315
 
<p>
316
 
For example, the TIFF format is defined like this:
317
 
</p>
318
 
<p>
319
 
</p>
320
 
<div class="informalexample"><pre class="programlisting">
321
 
typedef VipsFormat VipsFormatTiff;
322
 
typedef VipsFormatClass VipsFormatTiffClass;
323
 
 
324
 
static void
325
 
vips_format_tiff_class_init( VipsFormatTiffClass *class )
326
 
{
327
 
        VipsObjectClass *object_class = (VipsObjectClass *) class;
328
 
        VipsFormatClass *format_class = (VipsFormatClass *) class;
329
 
 
330
 
        object_class-&gt;nickname = "tiff";
331
 
        object_class-&gt;description = _( "TIFF" );
332
 
 
333
 
        format_class-&gt;is_a = istiff;
334
 
        format_class-&gt;header = tiff2vips_header;
335
 
        format_class-&gt;load = im_tiff2vips;
336
 
        format_class-&gt;save = im_vips2tiff;
337
 
        format_class-&gt;get_flags = tiff_flags;
338
 
        format_class-&gt;suffs = tiff_suffs;
339
 
}
340
 
 
341
 
static void
342
 
vips_format_tiff_init( VipsFormatTiff *object )
343
 
{
344
 
}
345
 
 
346
 
G_DEFINE_TYPE( VipsFormatTiff, vips_format_tiff, VIPS_TYPE_FORMAT );
347
 
</pre></div>
348
 
<p>
349
 
</p>
350
 
<p>
351
 
Then call <code class="function">vips_format_tiff_get_type()</code> somewhere in your init code to link
352
 
the format into VIPS (though of course the tiff format is linked in for you
353
 
already).
354
 
</p>
355
 
</div>
356
 
<hr>
357
 
<div class="refsect2">
358
 
<a name="VipsFormatClass"></a><h3>VipsFormatClass</h3>
359
 
<pre class="programlisting">typedef struct {
360
 
        VipsObjectClass parent_class;
361
 
 
362
 
        /* Is a file in this format.
363
 
         */
364
 
        gboolean (*is_a)( const char * );
365
 
 
366
 
        /* Read just the header into the VipsImage.
367
 
         */
368
 
        int (*header)( const char *, VipsImage * );
369
 
 
370
 
        /* Load the whole image.
371
 
         */
372
 
        int (*load)( const char *, VipsImage * );
373
 
 
374
 
        /* Write the VipsImage to the file in this format.
375
 
         */
376
 
        int (*save)( VipsImage *, const char * );
377
 
 
378
 
        /* Get the flags for this file in this format.
379
 
         */
380
 
        VipsFormatFlags (*get_flags)( const char * );
381
 
 
382
 
        /* Loop over formats in this order, default 0. We need this because
383
 
         * some formats can be read by several loaders (eg. tiff can be read
384
 
         * by the libMagick loader as well as by the tiff loader), and we want
385
 
         * to make sure the better loader comes first.
386
 
         */
387
 
        int priority;
388
 
 
389
 
        /* Null-terminated list of allowed suffixes, eg. ".tif", ".tiff".
390
 
         */
391
 
        const char **suffs;
392
 
} VipsFormatClass;
393
 
</pre>
394
 
</div>
395
 
<hr>
396
 
<div class="refsect2">
397
 
<a name="vips-format-map"></a><h3>vips_format_map ()</h3>
398
 
<pre class="programlisting"><span class="returnvalue">void</span> *              vips_format_map                     (<em class="parameter"><code><a class="link" href="libvips-util.html#VipsSListMap2Fn" title="VipsSListMap2Fn ()"><span class="type">VipsSListMap2Fn</span></a> fn</code></em>,
399
 
                                                         <em class="parameter"><code><span class="type">void</span> *a</code></em>,
400
 
                                                         <em class="parameter"><code><span class="type">void</span> *b</code></em>);</pre>
401
 
<p>
402
 
Apply a function to every <a class="link" href="VipsFormat.html#VipsFormatClass" title="VipsFormatClass"><code class="literal">VipsFormatClass</code></a> that VIPS knows about. Formats
403
 
are presented to the function in priority order. 
404
 
</p>
405
 
<p>
406
 
Like all VIPS map functions, if <em class="parameter"><code>fn</code></em> returns <code class="literal">NULL</code>, iteration continues. If
407
 
it returns non-<code class="literal">NULL</code>, iteration terminates and that value is returned. The
408
 
map function returns <code class="literal">NULL</code> if all calls return <code class="literal">NULL</code>.
409
 
</p>
410
 
<p>
411
 
See also: <code class="function">im_slist_map()</code>.
412
 
</p>
413
 
<div class="variablelist"><table border="0">
414
 
<col align="left" valign="top">
415
 
<tbody>
416
 
<tr>
417
 
<td><p><span class="term"><em class="parameter"><code>fn</code></em> :</span></p></td>
418
 
<td>function to apply to each <a class="link" href="VipsFormat.html#VipsFormatClass" title="VipsFormatClass"><span class="type">VipsFormatClass</span></a>
419
 
</td>
420
 
</tr>
421
 
<tr>
422
 
<td><p><span class="term"><em class="parameter"><code>a</code></em> :</span></p></td>
423
 
<td>user data</td>
424
 
</tr>
425
 
<tr>
426
 
<td><p><span class="term"><em class="parameter"><code>b</code></em> :</span></p></td>
427
 
<td>user data</td>
428
 
</tr>
429
 
<tr>
430
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
431
 
<td>the result of iteration</td>
432
 
</tr>
433
 
</tbody>
434
 
</table></div>
435
 
</div>
436
 
<hr>
437
 
<div class="refsect2">
438
 
<a name="vips-format-for-file"></a><h3>vips_format_for_file ()</h3>
439
 
<pre class="programlisting"><a class="link" href="VipsFormat.html#VipsFormatClass" title="VipsFormatClass"><span class="returnvalue">VipsFormatClass</span></a> *   vips_format_for_file                (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
440
 
<p>
441
 
Searches for a format you could use to load a file.
442
 
</p>
443
 
<p>
444
 
See also: <a class="link" href="VipsFormat.html#vips-format-read" title="vips_format_read ()"><code class="function">vips_format_read()</code></a>, <a class="link" href="VipsFormat.html#vips-format-for-name" title="vips_format_for_name ()"><code class="function">vips_format_for_name()</code></a>.
445
 
</p>
446
 
<div class="variablelist"><table border="0">
447
 
<col align="left" valign="top">
448
 
<tbody>
449
 
<tr>
450
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
451
 
<td>file to find a format for</td>
452
 
</tr>
453
 
<tr>
454
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
455
 
<td>a format on success, <code class="literal">NULL</code> on error</td>
456
 
</tr>
457
 
</tbody>
458
 
</table></div>
459
 
</div>
460
 
<hr>
461
 
<div class="refsect2">
462
 
<a name="vips-format-for-name"></a><h3>vips_format_for_name ()</h3>
463
 
<pre class="programlisting"><a class="link" href="VipsFormat.html#VipsFormatClass" title="VipsFormatClass"><span class="returnvalue">VipsFormatClass</span></a> *   vips_format_for_name                (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
464
 
<p>
465
 
Searches for a format you could use to save a file.
466
 
</p>
467
 
<p>
468
 
See also: <a class="link" href="VipsFormat.html#vips-format-write" title="vips_format_write ()"><code class="function">vips_format_write()</code></a>, <a class="link" href="VipsFormat.html#vips-format-for-file" title="vips_format_for_file ()"><code class="function">vips_format_for_file()</code></a>.
469
 
</p>
470
 
<div class="variablelist"><table border="0">
471
 
<col align="left" valign="top">
472
 
<tbody>
473
 
<tr>
474
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
475
 
<td>name to find a format for</td>
476
 
</tr>
477
 
<tr>
478
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
479
 
<td>a format on success, <code class="literal">NULL</code> on error</td>
480
 
</tr>
481
 
</tbody>
482
 
</table></div>
483
 
</div>
484
 
<hr>
485
 
<div class="refsect2">
486
 
<a name="vips-format-get-flags"></a><h3>vips_format_get_flags ()</h3>
487
 
<pre class="programlisting"><a class="link" href="VipsFormat.html#VipsFormatFlags" title="enum VipsFormatFlags"><span class="returnvalue">VipsFormatFlags</span></a>     vips_format_get_flags               (<em class="parameter"><code><a class="link" href="VipsFormat.html#VipsFormatClass" title="VipsFormatClass"><span class="type">VipsFormatClass</span></a> *format</code></em>,
488
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
489
 
<p>
490
 
Get a set of flags for this file.
491
 
</p>
492
 
<div class="variablelist"><table border="0">
493
 
<col align="left" valign="top">
494
 
<tbody>
495
 
<tr>
496
 
<td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
497
 
<td>format to test</td>
498
 
</tr>
499
 
<tr>
500
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
501
 
<td>file to test</td>
502
 
</tr>
503
 
<tr>
504
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
505
 
<td>flags for this format and file</td>
506
 
</tr>
507
 
</tbody>
508
 
</table></div>
509
 
</div>
510
 
<hr>
511
 
<div class="refsect2">
512
 
<a name="vips-format-read"></a><h3>vips_format_read ()</h3>
513
 
<pre class="programlisting"><span class="returnvalue">int</span>                 vips_format_read                    (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
514
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
515
 
<p>
516
 
Searches for a format for this file, then loads the file into <em class="parameter"><code>out</code></em>.
517
 
</p>
518
 
<p>
519
 
See also: <a class="link" href="VipsFormat.html#vips-format-write" title="vips_format_write ()"><code class="function">vips_format_write()</code></a>.
520
 
</p>
521
 
<div class="variablelist"><table border="0">
522
 
<col align="left" valign="top">
523
 
<tbody>
524
 
<tr>
525
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
526
 
<td>file to load</td>
527
 
</tr>
528
 
<tr>
529
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
530
 
<td>write the file to this image</td>
531
 
</tr>
532
 
<tr>
533
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
534
 
<td>0 on success, -1 on error</td>
535
 
</tr>
536
 
</tbody>
537
 
</table></div>
538
 
</div>
539
 
<hr>
540
 
<div class="refsect2">
541
 
<a name="vips-format-write"></a><h3>vips_format_write ()</h3>
542
 
<pre class="programlisting"><span class="returnvalue">int</span>                 vips_format_write                   (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
543
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
544
 
<p>
545
 
Searches for a format for this name, then saves <em class="parameter"><code>im</code></em> to it.
546
 
</p>
547
 
<p>
548
 
See also: <a class="link" href="VipsFormat.html#vips-format-read" title="vips_format_read ()"><code class="function">vips_format_read()</code></a>.
549
 
</p>
550
 
<div class="variablelist"><table border="0">
551
 
<col align="left" valign="top">
552
 
<tbody>
553
 
<tr>
554
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
555
 
<td>image to write</td>
556
 
</tr>
557
 
<tr>
558
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
559
 
<td>file to write to</td>
560
 
</tr>
561
 
<tr>
562
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
563
 
<td>0 on success, -1 on error</td>
564
 
</tr>
565
 
</tbody>
566
 
</table></div>
567
 
</div>
568
 
<hr>
569
 
<div class="refsect2">
570
 
<a name="im-jpeg2vips"></a><h3>im_jpeg2vips ()</h3>
571
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_jpeg2vips                        (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
572
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
573
 
<p>
574
 
Read a JPEG file into a VIPS image. It can read most 8-bit JPEG images, 
575
 
including CMYK and YCbCr.
576
 
</p>
577
 
<p>
578
 
You can embed options in the filename. They have the form:
579
 
</p>
580
 
<p>
581
 
</p>
582
 
<div class="informalexample"><pre class="programlisting">
583
 
filename.jpg:<span class="emphasis"><em>shrink-factor</em></span>,<span class="emphasis"><em>fail</em></span>
584
 
</pre></div>
585
 
<p>
586
 
</p>
587
 
<p>
588
 
</p>
589
 
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
590
 
<li class="listitem"><p>
591
 
<span class="emphasis"><em>shrink-factor</em></span> 
592
 
Shrink by this integer factor during load.  Allowed values are 1, 2, 4
593
 
and 8. Shrinking during read is very much faster than decompressing the 
594
 
whole image and then shrinking. 
595
 
    </p></li>
596
 
<li class="listitem"><p>
597
 
<span class="emphasis"><em>fail</em></span> 
598
 
This makes the JPEG reader fail on any warnings. This can be useful for 
599
 
detecting truncated files, for example. Normally reading these produces 
600
 
a warning, but no fatal error.  
601
 
    </p></li>
602
 
</ul></div>
603
 
<p>
604
 
</p>
605
 
<p>
606
 
Example:
607
 
</p>
608
 
<p>
609
 
</p>
610
 
<div class="informalexample"><pre class="programlisting">
611
 
im_jpeg2vips( "fred.jpg:8" out );
612
 
im_jpeg2vips( "fred.jpg:,fail" out );
613
 
</pre></div>
614
 
<p>
615
 
</p>
616
 
<p>
617
 
The first example will shrink by a factor of 8 during load. The second will
618
 
fail with an error if there are any problems loading the file.
619
 
</p>
620
 
<p>
621
 
Any embedded ICC profiles are ignored: you always just get the RGB from 
622
 
the file. Instead, the embedded profile will be attached to the image as 
623
 
metadata.  You need to use something like <a class="link" href="libvips-colour.html#im-icc-import" title="im_icc_import ()"><code class="function">im_icc_import()</code></a> to get CIE 
624
 
values from the file. Any EXIF data is also attached as VIPS metadata.
625
 
</p>
626
 
<p>
627
 
The int metadata item "jpeg-multiscan" is set to the result of 
628
 
<code class="function">jpeg_has_multiple_scans()</code>. Interlaced jpeg images need a large amount of
629
 
memory to load, so this field gives callers a chance to handle these
630
 
images differently.
631
 
</p>
632
 
<p>
633
 
The EXIF thumbnail, if present, is attached to the image as 
634
 
"jpeg-thumbnail-data". See <code class="function">im_meta_get_blob()</code>.
635
 
</p>
636
 
<p>
637
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-vips2jpeg" title="im_vips2jpeg ()"><code class="function">im_vips2jpeg()</code></a>.
638
 
</p>
639
 
<div class="variablelist"><table border="0">
640
 
<col align="left" valign="top">
641
 
<tbody>
642
 
<tr>
643
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
644
 
<td>file to load</td>
645
 
</tr>
646
 
<tr>
647
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
648
 
<td>image to write to</td>
649
 
</tr>
650
 
<tr>
651
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
652
 
<td>0 on success, -1 on error.</td>
653
 
</tr>
654
 
</tbody>
655
 
</table></div>
656
 
</div>
657
 
<hr>
658
 
<div class="refsect2">
659
 
<a name="im-bufjpeg2vips"></a><h3>im_bufjpeg2vips ()</h3>
660
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_bufjpeg2vips                     (<em class="parameter"><code><span class="type">void</span> *buf</code></em>,
661
 
                                                         <em class="parameter"><code><span class="type">size_t</span> len</code></em>,
662
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
663
 
                                                         <em class="parameter"><code><span class="type">gboolean</span> header_only</code></em>);</pre>
664
 
<p>
665
 
Read a JPEG-formatted memory block into a VIPS image. It can read most 
666
 
8-bit JPEG images, including CMYK and YCbCr.
667
 
</p>
668
 
<p>
669
 
This function is handy for processing JPEG image thumbnails.
670
 
</p>
671
 
<p>
672
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-jpeg2vips" title="im_jpeg2vips ()"><code class="function">im_jpeg2vips()</code></a>.
673
 
</p>
674
 
<div class="variablelist"><table border="0">
675
 
<col align="left" valign="top">
676
 
<tbody>
677
 
<tr>
678
 
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
679
 
<td>memory area to load</td>
680
 
</tr>
681
 
<tr>
682
 
<td><p><span class="term"><em class="parameter"><code>len</code></em> :</span></p></td>
683
 
<td>size of memory area</td>
684
 
</tr>
685
 
<tr>
686
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
687
 
<td>image to write</td>
688
 
</tr>
689
 
<tr>
690
 
<td><p><span class="term"><em class="parameter"><code>header_only</code></em> :</span></p></td>
691
 
<td>set to just read the header</td>
692
 
</tr>
693
 
<tr>
694
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
695
 
<td>0 on success, -1 on error.</td>
696
 
</tr>
697
 
</tbody>
698
 
</table></div>
699
 
</div>
700
 
<hr>
701
 
<div class="refsect2">
702
 
<a name="im-vips2jpeg"></a><h3>im_vips2jpeg ()</h3>
703
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_vips2jpeg                        (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
704
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
705
 
<p>
706
 
Write a VIPS image to a file as JPEG.
707
 
</p>
708
 
<p>
709
 
You can embed options in the filename. They have the form:
710
 
</p>
711
 
<p>
712
 
</p>
713
 
<div class="informalexample"><pre class="programlisting">
714
 
filename.jpg:<span class="emphasis"><em>compression</em></span>,<span class="emphasis"><em>profile</em></span>
715
 
</pre></div>
716
 
<p>
717
 
</p>
718
 
<p>
719
 
</p>
720
 
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
721
 
<li class="listitem"><p>
722
 
<span class="emphasis"><em>compression</em></span> 
723
 
Compress with this quality factor. Default 75.
724
 
    </p></li>
725
 
<li class="listitem"><p>
726
 
<span class="emphasis"><em>profile</em></span> 
727
 
Attach this ICC profile. For example, "fred.jpg:,/home/john/srgb.icc" will 
728
 
embed the profile stored in the file "/home/john/srgb.icc" in the JPEG 
729
 
image. This does not affect the pixels which are written, just the way 
730
 
they are tagged. You can use the special string "none" to mean 
731
 
"don't attach a profile".
732
 
    </p></li>
733
 
</ul></div>
734
 
<p>
735
 
</p>
736
 
<p>
737
 
If no profile is specified in the save string and the VIPS header 
738
 
contains an ICC profile named IM_META_ICC_NAME ("icc-profile-data"), the
739
 
profile from the VIPS header will be attached.
740
 
</p>
741
 
<p>
742
 
The image is automatically converted to RGB, Monochrome or CMYK before 
743
 
saving. Any metadata attached to the image is saved as EXIF, if possible.
744
 
</p>
745
 
<p>
746
 
Example:
747
 
</p>
748
 
<p>
749
 
</p>
750
 
<div class="informalexample"><pre class="programlisting">
751
 
im_vips2jpeg( in, "fred.jpg:99,none" );
752
 
</pre></div>
753
 
<p>
754
 
</p>
755
 
<p>
756
 
Will write "fred.jpg" at high-quality with no ICC profile.
757
 
</p>
758
 
<p>
759
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-jpeg2vips" title="im_jpeg2vips ()"><code class="function">im_jpeg2vips()</code></a>.
760
 
</p>
761
 
<div class="variablelist"><table border="0">
762
 
<col align="left" valign="top">
763
 
<tbody>
764
 
<tr>
765
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
766
 
<td>image to save</td>
767
 
</tr>
768
 
<tr>
769
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
770
 
<td>file to write to</td>
771
 
</tr>
772
 
<tr>
773
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
774
 
<td>0 on success, -1 on error.</td>
775
 
</tr>
776
 
</tbody>
777
 
</table></div>
778
 
</div>
779
 
<hr>
780
 
<div class="refsect2">
781
 
<a name="im-vips2mimejpeg"></a><h3>im_vips2mimejpeg ()</h3>
782
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_vips2mimejpeg                    (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
783
 
                                                         <em class="parameter"><code><span class="type">int</span> qfac</code></em>);</pre>
784
 
<p>
785
 
As <a class="link" href="VipsFormat.html#im-vips2jpeg" title="im_vips2jpeg ()"><code class="function">im_vips2jpeg()</code></a>, but save as a mime jpeg on stdout.
786
 
</p>
787
 
<p>
788
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-vips2jpeg" title="im_vips2jpeg ()"><code class="function">im_vips2jpeg()</code></a>.
789
 
</p>
790
 
<div class="variablelist"><table border="0">
791
 
<col align="left" valign="top">
792
 
<tbody>
793
 
<tr>
794
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
795
 
<td>image to save</td>
796
 
</tr>
797
 
<tr>
798
 
<td><p><span class="term"><em class="parameter"><code>qfac</code></em> :</span></p></td>
799
 
<td>JPEG quality factor</td>
800
 
</tr>
801
 
<tr>
802
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
803
 
<td>0 on success, -1 on error.</td>
804
 
</tr>
805
 
</tbody>
806
 
</table></div>
807
 
</div>
808
 
<hr>
809
 
<div class="refsect2">
810
 
<a name="im-vips2bufjpeg"></a><h3>im_vips2bufjpeg ()</h3>
811
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_vips2bufjpeg                     (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
812
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
813
 
                                                         <em class="parameter"><code><span class="type">int</span> qfac</code></em>,
814
 
                                                         <em class="parameter"><code><span class="type">char</span> **obuf</code></em>,
815
 
                                                         <em class="parameter"><code><span class="type">int</span> *olen</code></em>);</pre>
816
 
<p>
817
 
As <a class="link" href="VipsFormat.html#im-vips2jpeg" title="im_vips2jpeg ()"><code class="function">im_vips2jpeg()</code></a>, but save as a memory buffer. The memory is allocated
818
 
local to <em class="parameter"><code>out</code></em> (that is, when <em class="parameter"><code>out</code></em> is closed the memory will be released,
819
 
pass <code class="literal">NULL</code> to release yourself). 
820
 
</p>
821
 
<p>
822
 
The address of the buffer is returned in <em class="parameter"><code>obuf</code></em>, the length of the buffer in
823
 
<em class="parameter"><code>olen</code></em>. <em class="parameter"><code>olen</code></em> should really be a size_t rather than an int :-(
824
 
</p>
825
 
<p>
826
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-vips2jpeg" title="im_vips2jpeg ()"><code class="function">im_vips2jpeg()</code></a>.
827
 
</p>
828
 
<div class="variablelist"><table border="0">
829
 
<col align="left" valign="top">
830
 
<tbody>
831
 
<tr>
832
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
833
 
<td>image to save</td>
834
 
</tr>
835
 
<tr>
836
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
837
 
<td>allocate output buffer local to this</td>
838
 
</tr>
839
 
<tr>
840
 
<td><p><span class="term"><em class="parameter"><code>qfac</code></em> :</span></p></td>
841
 
<td>JPEG quality factor</td>
842
 
</tr>
843
 
<tr>
844
 
<td><p><span class="term"><em class="parameter"><code>obuf</code></em> :</span></p></td>
845
 
<td>return output buffer here</td>
846
 
</tr>
847
 
<tr>
848
 
<td><p><span class="term"><em class="parameter"><code>olen</code></em> :</span></p></td>
849
 
<td>return output length here</td>
850
 
</tr>
851
 
<tr>
852
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
853
 
<td>0 on success, -1 on error.</td>
854
 
</tr>
855
 
</tbody>
856
 
</table></div>
857
 
</div>
858
 
<hr>
859
 
<div class="refsect2">
860
 
<a name="im-tiff2vips"></a><h3>im_tiff2vips ()</h3>
861
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_tiff2vips                        (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
862
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
863
 
<p>
864
 
Read a TIFF file into a VIPS image. It is a full baseline TIFF 6 reader, 
865
 
with extensions for tiled images, multipage images, LAB colour space, 
866
 
pyramidal images and JPEG compression. including CMYK and YCbCr.
867
 
</p>
868
 
<p>
869
 
You can embed a page number in the filename. For example: 
870
 
</p>
871
 
<p>
872
 
</p>
873
 
<div class="informalexample"><pre class="programlisting">
874
 
im_tiff2vips( "fred.tif:23", out );
875
 
</pre></div>
876
 
<p>
877
 
</p>
878
 
<p>
879
 
Will read page 23. By default, the operation reads the first page.
880
 
</p>
881
 
<p>
882
 
Any ICC profile is read out and attached to the VIPS image.
883
 
</p>
884
 
<p>
885
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-vips2tiff" title="im_vips2tiff ()"><code class="function">im_vips2tiff()</code></a>.
886
 
</p>
887
 
<div class="variablelist"><table border="0">
888
 
<col align="left" valign="top">
889
 
<tbody>
890
 
<tr>
891
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
892
 
<td>file to load</td>
893
 
</tr>
894
 
<tr>
895
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
896
 
<td>image to write to</td>
897
 
</tr>
898
 
<tr>
899
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
900
 
<td>0 on success, -1 on error.</td>
901
 
</tr>
902
 
</tbody>
903
 
</table></div>
904
 
</div>
905
 
<hr>
906
 
<div class="refsect2">
907
 
<a name="im-vips2tiff"></a><h3>im_vips2tiff ()</h3>
908
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_vips2tiff                        (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
909
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
910
 
<p>
911
 
Write a VIPS image to a file as TIFF.
912
 
</p>
913
 
<p>
914
 
You can embed options in the filename. They have the form:
915
 
</p>
916
 
<p>
917
 
</p>
918
 
<div class="informalexample"><pre class="programlisting">
919
 
filename.tif:<span class="emphasis"><em>compression</em></span>,<span class="emphasis"><em>layout</em></span>,<span class="emphasis"><em>multi-res</em></span>,<span class="emphasis"><em>format</em></span>,<span class="emphasis"><em>resolution</em></span>,<span class="emphasis"><em>icc</em></span>, <span class="emphasis"><em>bigtiff</em></span>
920
 
</pre></div>
921
 
<p>
922
 
</p>
923
 
<p>
924
 
</p>
925
 
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
926
 
<li class="listitem">
927
 
<p>
928
 
<span class="emphasis"><em>compression</em></span> 
929
 
should be one of "none" (no compression), "jpeg" (JPEG compression), 
930
 
"deflate" (ZIP compression), "packbits" (TIFF packbits compression),
931
 
"ccittfax4" (CCITT Group 4 fax encoding), "lzw"  (Lempel-Ziv compression).
932
 
</p>
933
 
<p>
934
 
"jpeg" compression can be followed by a ":" character and a JPEG quality
935
 
level; "lzw" and "deflate" can be followed by a ":" and predictor value. 
936
 
The default compression type is "none", the default JPEG quality factor 
937
 
is 75.
938
 
</p>
939
 
<p>
940
 
Predictor is not set by default. There are three predictor values recognised
941
 
at the moment (2007, July): 1 is no prediction, 2 is a horizontal 
942
 
differencing and 3 is a floating point predictor. Refer to the libtiff 
943
 
specifications for further discussion of various predictors. In short, 
944
 
predictor helps to better compress image, especially in case of digital 
945
 
photos or scanned images and bit depths &gt; 8. Try it to find whether it 
946
 
works for your images.
947
 
</p>
948
 
<p>
949
 
JPEG compression is a good lossy compressor for photographs, packbits is 
950
 
good for 1-bit images, and deflate is the best lossless compression TIFF 
951
 
can do. LZW has patent problems and is no longer recommended.
952
 
    </p>
953
 
</li>
954
 
<li class="listitem">
955
 
<p>
956
 
<span class="emphasis"><em>layout</em></span> 
957
 
should be "strip" (strip layout) or "tile" (tiled layout).
958
 
</p>
959
 
<p>
960
 
"tile" layout can be followed by a ":" character and the horizontal and
961
 
vertical tile size, separated by a "x" character. The default layout is
962
 
"strip", and the default tile size is 128 by 128 pixels.
963
 
    </p>
964
 
</li>
965
 
<li class="listitem"><p>
966
 
<span class="emphasis"><em>multi-res</em></span> 
967
 
should be "flat" (single image) or "pyramid" (many images arranged in a 
968
 
pyramid). The default multi-res mode is "flat".
969
 
    </p></li>
970
 
<li class="listitem"><p>
971
 
<span class="emphasis"><em>format</em></span> 
972
 
shoiuld be "manybit" (don't bit-reduce images) or "onebit" (one band 8 
973
 
bit images are saved as 1 bit). The default format is "multibit". 
974
 
    </p></li>
975
 
<li class="listitem">
976
 
<p>
977
 
<span class="emphasis"><em>resolution</em></span> 
978
 
should be "res_cm"  (output resolution unit is pixels per centimetre) or 
979
 
"res_inch"  (output resolution unit is pixels per inch). The default 
980
 
resolution unit is taken from the header field "resolution-unit"
981
 
(<span class="type">IM_META_RESOLUTION_UNIT</span> in C). If this field is not set, then 
982
 
VIPS defaults to cm.
983
 
</p>
984
 
<p>
985
 
The unit can optionally be followed by a ":" character and the 
986
 
horizontal and vertical resolution, separated by a "x" character. 
987
 
You can have a single number with no "x" and set the horizontal and 
988
 
vertical resolutions together. 
989
 
    </p>
990
 
</li>
991
 
<li class="listitem"><p>
992
 
<span class="emphasis"><em>icc</em></span> 
993
 
Attach this ICC profile. 
994
 
This does not affect the pixels which are written, just the way 
995
 
they are tagged. 
996
 
    </p></li>
997
 
<li class="listitem"><p>
998
 
<span class="emphasis"><em>bigtiff</em></span> 
999
 
Set this to 8 to enable bigtiff output. Bigtiff is a variant of the TIFF
1000
 
format that allows more than 4GB in a file.
1001
 
    </p></li>
1002
 
</ul></div>
1003
 
<p>
1004
 
</p>
1005
 
<p>
1006
 
Example:
1007
 
</p>
1008
 
<p>
1009
 
</p>
1010
 
<div class="informalexample"><pre class="programlisting">
1011
 
im_vips2jpeg( in, "fred.tif:jpeg,tile,pyramid" );
1012
 
</pre></div>
1013
 
<p>
1014
 
</p>
1015
 
<p>
1016
 
Will write "fred.tif" as a tiled jpeg-compressed pyramid.
1017
 
</p>
1018
 
<p>
1019
 
</p>
1020
 
<div class="informalexample"><pre class="programlisting">
1021
 
im_vips2jpeg( in, "fred.tif:packbits,tile,,onebit" ); 
1022
 
</pre></div>
1023
 
<p>
1024
 
</p>
1025
 
<p>
1026
 
Writes a tiled one bit TIFF image (provided fred.v is a one band 8 bit 
1027
 
image) compressed with packbits.
1028
 
</p>
1029
 
<p>
1030
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-tiff2vips" title="im_tiff2vips ()"><code class="function">im_tiff2vips()</code></a>.
1031
 
</p>
1032
 
<div class="variablelist"><table border="0">
1033
 
<col align="left" valign="top">
1034
 
<tbody>
1035
 
<tr>
1036
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1037
 
<td>image to save</td>
1038
 
</tr>
1039
 
<tr>
1040
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1041
 
<td>file to write to</td>
1042
 
</tr>
1043
 
<tr>
1044
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1045
 
<td>0 on success, -1 on error.</td>
1046
 
</tr>
1047
 
</tbody>
1048
 
</table></div>
1049
 
</div>
1050
 
<hr>
1051
 
<div class="refsect2">
1052
 
<a name="im-tile-cache"></a><h3>im_tile_cache ()</h3>
1053
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_tile_cache                       (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1054
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
1055
 
                                                         <em class="parameter"><code><span class="type">int</span> tile_width</code></em>,
1056
 
                                                         <em class="parameter"><code><span class="type">int</span> tile_height</code></em>,
1057
 
                                                         <em class="parameter"><code><span class="type">int</span> max_tiles</code></em>);</pre>
1058
 
<p>
1059
 
This operation behaves rather like <a class="link" href="libvips-conversion.html#im-copy" title="im_copy ()"><code class="function">im_copy()</code></a> between images
1060
 
<em class="parameter"><code>in</code></em> and <em class="parameter"><code>out</code></em>, except that it keeps a cache of computed pixels. 
1061
 
This cache is made of up to <em class="parameter"><code>max_tiles</code></em> tiles (a value of -1 for
1062
 
means any number of tiles), and each tile is of size <em class="parameter"><code>tile_width</code></em>
1063
 
by <em class="parameter"><code>tile_height</code></em> pixels. Each cache tile is made with a single call to 
1064
 
<code class="function">im_prepare()</code>.
1065
 
</p>
1066
 
<p>
1067
 
This is a lower-level operation than <code class="function">im_cache()</code> since it does no 
1068
 
subdivision. It is suitable for caching the output of operations like
1069
 
<a class="link" href="VipsFormat.html#im-exr2vips" title="im_exr2vips ()"><code class="function">im_exr2vips()</code></a> on tiled images.
1070
 
</p>
1071
 
<p>
1072
 
See also: <code class="function">im_cache()</code>.
1073
 
</p>
1074
 
<div class="variablelist"><table border="0">
1075
 
<col align="left" valign="top">
1076
 
<tbody>
1077
 
<tr>
1078
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1079
 
<td>input image</td>
1080
 
</tr>
1081
 
<tr>
1082
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1083
 
<td>output image</td>
1084
 
</tr>
1085
 
<tr>
1086
 
<td><p><span class="term"><em class="parameter"><code>tile_width</code></em> :</span></p></td>
1087
 
<td>tile width</td>
1088
 
</tr>
1089
 
<tr>
1090
 
<td><p><span class="term"><em class="parameter"><code>tile_height</code></em> :</span></p></td>
1091
 
<td>tile height</td>
1092
 
</tr>
1093
 
<tr>
1094
 
<td><p><span class="term"><em class="parameter"><code>max_tiles</code></em> :</span></p></td>
1095
 
<td>maximum number of tiles to cache</td>
1096
 
</tr>
1097
 
<tr>
1098
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1099
 
<td>0 on success, -1 on error.</td>
1100
 
</tr>
1101
 
</tbody>
1102
 
</table></div>
1103
 
</div>
1104
 
<hr>
1105
 
<div class="refsect2">
1106
 
<a name="im-magick2vips"></a><h3>im_magick2vips ()</h3>
1107
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_magick2vips                      (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1108
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
1109
 
<p>
1110
 
Read in an image using libMagick, the ImageMagick library. This library can
1111
 
read more than 80 file formats, including SVG, BMP, EPS, DICOM and many 
1112
 
others.
1113
 
The reader can handle any ImageMagick image, including the float and double
1114
 
formats. It will work with any quantum size, including HDR. Any metadata
1115
 
attached to the libMagick image is copied on to the VIPS image.
1116
 
</p>
1117
 
<p>
1118
 
The reader should also work with most versions of GraphicsMagick.
1119
 
</p>
1120
 
<p>
1121
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>.
1122
 
</p>
1123
 
<div class="variablelist"><table border="0">
1124
 
<col align="left" valign="top">
1125
 
<tbody>
1126
 
<tr>
1127
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1128
 
<td>file to load</td>
1129
 
</tr>
1130
 
<tr>
1131
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1132
 
<td>image to write to</td>
1133
 
</tr>
1134
 
<tr>
1135
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1136
 
<td>0 on success, -1 on error.</td>
1137
 
</tr>
1138
 
</tbody>
1139
 
</table></div>
1140
 
</div>
1141
 
<hr>
1142
 
<div class="refsect2">
1143
 
<a name="im-exr2vips"></a><h3>im_exr2vips ()</h3>
1144
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_exr2vips                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1145
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
1146
 
<p>
1147
 
Read a OpenEXR file into a VIPS image. 
1148
 
</p>
1149
 
<p>
1150
 
The reader can handle scanline and tiled OpenEXR images. It can't handle
1151
 
OpenEXR colour management, image attributes, many pixel formats, anything
1152
 
other than RGBA.
1153
 
</p>
1154
 
<p>
1155
 
This reader uses the rather limited OpenEXR C API. It should really be
1156
 
redone in C++.
1157
 
</p>
1158
 
<p>
1159
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>.
1160
 
</p>
1161
 
<div class="variablelist"><table border="0">
1162
 
<col align="left" valign="top">
1163
 
<tbody>
1164
 
<tr>
1165
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1166
 
<td>file to load</td>
1167
 
</tr>
1168
 
<tr>
1169
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1170
 
<td>image to write to</td>
1171
 
</tr>
1172
 
<tr>
1173
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1174
 
<td>0 on success, -1 on error.</td>
1175
 
</tr>
1176
 
</tbody>
1177
 
</table></div>
1178
 
</div>
1179
 
<hr>
1180
 
<div class="refsect2">
1181
 
<a name="im-ppm2vips"></a><h3>im_ppm2vips ()</h3>
1182
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_ppm2vips                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1183
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
1184
 
<p>
1185
 
Read a PPM/PBM/PGM/PFM file into a VIPS image. 
1186
 
It can read 1, 8, 16 and 32 bit images, colour or monochrome,
1187
 
stored in binary or in ASCII. One bit images become 8 bit VIPS images, 
1188
 
with 0 and 255 for 0 and 1.
1189
 
</p>
1190
 
<p>
1191
 
PFM images have the scale factor attached as "pfm-scale".
1192
 
</p>
1193
 
<p>
1194
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-vips2ppm" title="im_vips2ppm ()"><code class="function">im_vips2ppm()</code></a>, <code class="function">im_meta_get_double()</code>
1195
 
</p>
1196
 
<div class="variablelist"><table border="0">
1197
 
<col align="left" valign="top">
1198
 
<tbody>
1199
 
<tr>
1200
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1201
 
<td>file to load</td>
1202
 
</tr>
1203
 
<tr>
1204
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1205
 
<td>image to write to</td>
1206
 
</tr>
1207
 
<tr>
1208
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1209
 
<td>0 on success, -1 on error.</td>
1210
 
</tr>
1211
 
</tbody>
1212
 
</table></div>
1213
 
</div>
1214
 
<hr>
1215
 
<div class="refsect2">
1216
 
<a name="im-vips2ppm"></a><h3>im_vips2ppm ()</h3>
1217
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_vips2ppm                         (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1218
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
1219
 
<p>
1220
 
Write a VIPS image to a file as PPM. It can write 8, 16 or
1221
 
32 bit unsigned integer images, float images, colour or monochrome, 
1222
 
stored as binary or ASCII. 
1223
 
Integer images of more than 8 bits can only be stored in ASCII.
1224
 
</p>
1225
 
<p>
1226
 
When writing float (PFM) images the scale factor is set from the 
1227
 
"pfm-scale" metadata.
1228
 
</p>
1229
 
<p>
1230
 
The storage format is indicated by a filename extension, for example:
1231
 
</p>
1232
 
<p>
1233
 
</p>
1234
 
<div class="informalexample"><pre class="programlisting"> 
1235
 
im_vips2ppm( im, "fred.ppm:ascii" )
1236
 
</pre></div>
1237
 
<p>
1238
 
</p>
1239
 
<p>
1240
 
will write to "fred.ppm" in ascii format. The default is binary.
1241
 
</p>
1242
 
<p>
1243
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-ppm2vips" title="im_ppm2vips ()"><code class="function">im_ppm2vips()</code></a>, <code class="function">im_meta_set_double()</code>.
1244
 
</p>
1245
 
<div class="variablelist"><table border="0">
1246
 
<col align="left" valign="top">
1247
 
<tbody>
1248
 
<tr>
1249
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1250
 
<td>image to save</td>
1251
 
</tr>
1252
 
<tr>
1253
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1254
 
<td>file to write to</td>
1255
 
</tr>
1256
 
<tr>
1257
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1258
 
<td>0 on success, -1 on error.</td>
1259
 
</tr>
1260
 
</tbody>
1261
 
</table></div>
1262
 
</div>
1263
 
<hr>
1264
 
<div class="refsect2">
1265
 
<a name="im-analyze2vips"></a><h3>im_analyze2vips ()</h3>
1266
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_analyze2vips                     (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1267
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
1268
 
<p>
1269
 
Load an Analyze 6.0 file. If <em class="parameter"><code>filename</code></em> is "fred.img", this will look for
1270
 
an image header called "fred.hdr" and pixel data in "fred.img". You can
1271
 
also load "fred" or "fred.hdr".
1272
 
</p>
1273
 
<p>
1274
 
Images are
1275
 
loaded lazilly and byte-swapped, if necessary. The Analyze metadata is read
1276
 
and attached.
1277
 
</p>
1278
 
<p>
1279
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <code class="function">im_meta_get()</code>, <a class="link" href="libvips-conversion.html#im-grid" title="im_grid ()"><code class="function">im_grid()</code></a>.
1280
 
</p>
1281
 
<div class="variablelist"><table border="0">
1282
 
<col align="left" valign="top">
1283
 
<tbody>
1284
 
<tr>
1285
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1286
 
<td>file to load</td>
1287
 
</tr>
1288
 
<tr>
1289
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1290
 
<td>image to write to</td>
1291
 
</tr>
1292
 
<tr>
1293
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1294
 
<td>0 on success, -1 on error.</td>
1295
 
</tr>
1296
 
</tbody>
1297
 
</table></div>
1298
 
</div>
1299
 
<hr>
1300
 
<div class="refsect2">
1301
 
<a name="im-csv2vips"></a><h3>im_csv2vips ()</h3>
1302
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_csv2vips                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1303
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
1304
 
<p>
1305
 
Load a CSV (comma-separated values) file. The output image is always 1 
1306
 
band (monochrome), <code class="literal">IM_BANDFMT_DOUBLE</code>. 
1307
 
The reader is deliberately rather fussy: it will fail if there are any 
1308
 
short lines, or if the file is too short. It will ignore lines that are 
1309
 
too long.
1310
 
</p>
1311
 
<p>
1312
 
Read options can be embedded in the filename. The options can be given 
1313
 
in any order and are:
1314
 
</p>
1315
 
<p>
1316
 
</p>
1317
 
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
1318
 
<li class="listitem"><p>
1319
 
<span class="emphasis"><em>skip:lines-to-skip</em></span> The number of lines to skip at 
1320
 
the start of the file. Default zero.
1321
 
    </p></li>
1322
 
<li class="listitem"><p>
1323
 
<span class="emphasis"><em>line:lines-to-read</em></span> 
1324
 
The number of lines to read from the file. Default -1, meaning read to end of
1325
 
file.
1326
 
    </p></li>
1327
 
<li class="listitem"><p>
1328
 
<span class="emphasis"><em>whi:whitespace-characters</em></span> 
1329
 
The skippable whitespace characters. Default <span class="emphasis"><em>space</em></span> and 
1330
 
double quotes (").
1331
 
Whitespace characters are always run together.
1332
 
    </p></li>
1333
 
<li class="listitem"><p>
1334
 
<span class="emphasis"><em>sep:separator-characters</em></span> 
1335
 
The characters that separate fields. Default ;,<span class="emphasis"><em>tab</em></span>. 
1336
 
Separators are never run together.
1337
 
    </p></li>
1338
 
</ul></div>
1339
 
<p>
1340
 
</p>
1341
 
<p>
1342
 
For example:
1343
 
</p>
1344
 
<p>
1345
 
</p>
1346
 
<div class="informalexample"><pre class="programlisting">
1347
 
im_csv2vips( "fred.csv:skip:58,sep:\,,line:3", out );
1348
 
</pre></div>
1349
 
<p>
1350
 
</p>
1351
 
<p>
1352
 
Will read three lines starting at line 59, with comma as the only
1353
 
allowed separator. Note that the ',' has to be escaped with a backslash.
1354
 
</p>
1355
 
<p>
1356
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-vips2csv" title="im_vips2csv ()"><code class="function">im_vips2csv()</code></a>, <a class="link" href="libvips-mask.html#im-read-dmask" title="im_read_dmask ()"><code class="function">im_read_dmask()</code></a>, <a class="link" href="VipsFormat.html#im-ppm2vips" title="im_ppm2vips ()"><code class="function">im_ppm2vips()</code></a>.
1357
 
</p>
1358
 
<div class="variablelist"><table border="0">
1359
 
<col align="left" valign="top">
1360
 
<tbody>
1361
 
<tr>
1362
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1363
 
<td>file to load</td>
1364
 
</tr>
1365
 
<tr>
1366
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1367
 
<td>image to write to</td>
1368
 
</tr>
1369
 
<tr>
1370
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1371
 
<td>0 on success, -1 on error.</td>
1372
 
</tr>
1373
 
</tbody>
1374
 
</table></div>
1375
 
</div>
1376
 
<hr>
1377
 
<div class="refsect2">
1378
 
<a name="im-vips2csv"></a><h3>im_vips2csv ()</h3>
1379
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_vips2csv                         (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1380
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
1381
 
<p>
1382
 
Save a CSV (comma-separated values) file. The image is written
1383
 
one line of text per scanline. Complex numbers are written as 
1384
 
"(real,imaginary)" and will need extra parsing I guess. The image must
1385
 
have a single band.
1386
 
</p>
1387
 
<p>
1388
 
Write options can be embedded in the filename. The options can be given 
1389
 
in any order and are:
1390
 
</p>
1391
 
<p>
1392
 
</p>
1393
 
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
1394
 
<span class="emphasis"><em>sep:separator-string</em></span> 
1395
 
The string to use to separate numbers in the output. 
1396
 
The default is "\\t" (tab).
1397
 
    </p></li></ul></div>
1398
 
<p>
1399
 
</p>
1400
 
<p>
1401
 
For example:
1402
 
</p>
1403
 
<p>
1404
 
</p>
1405
 
<div class="informalexample"><pre class="programlisting">
1406
 
im_csv2vips( in, "fred.csv:sep:\t" );
1407
 
</pre></div>
1408
 
<p>
1409
 
</p>
1410
 
<p>
1411
 
Will write to fred.csv, separating numbers with tab characters.
1412
 
</p>
1413
 
<p>
1414
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-csv2vips" title="im_csv2vips ()"><code class="function">im_csv2vips()</code></a>, <a class="link" href="libvips-mask.html#im-write-dmask" title="im_write_dmask ()"><code class="function">im_write_dmask()</code></a>, <a class="link" href="VipsFormat.html#im-vips2ppm" title="im_vips2ppm ()"><code class="function">im_vips2ppm()</code></a>.
1415
 
</p>
1416
 
<div class="variablelist"><table border="0">
1417
 
<col align="left" valign="top">
1418
 
<tbody>
1419
 
<tr>
1420
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1421
 
<td>image to save</td>
1422
 
</tr>
1423
 
<tr>
1424
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1425
 
<td>file to write to</td>
1426
 
</tr>
1427
 
<tr>
1428
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1429
 
<td>0 on success, -1 on error.</td>
1430
 
</tr>
1431
 
</tbody>
1432
 
</table></div>
1433
 
</div>
1434
 
<hr>
1435
 
<div class="refsect2">
1436
 
<a name="im-png2vips"></a><h3>im_png2vips ()</h3>
1437
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_png2vips                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1438
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
1439
 
<p>
1440
 
Read a PNG file into a VIPS image. It can read all png images, including 8-
1441
 
and 16-bit images, 1 and 3 channel, with and without an alpha channel.
1442
 
</p>
1443
 
<p>
1444
 
There is no support for embedded ICC profiles.
1445
 
</p>
1446
 
<p>
1447
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-vips2png" title="im_vips2png ()"><code class="function">im_vips2png()</code></a>.
1448
 
</p>
1449
 
<div class="variablelist"><table border="0">
1450
 
<col align="left" valign="top">
1451
 
<tbody>
1452
 
<tr>
1453
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1454
 
<td>file to load</td>
1455
 
</tr>
1456
 
<tr>
1457
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1458
 
<td>image to write to</td>
1459
 
</tr>
1460
 
<tr>
1461
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1462
 
<td>0 on success, -1 on error.</td>
1463
 
</tr>
1464
 
</tbody>
1465
 
</table></div>
1466
 
</div>
1467
 
<hr>
1468
 
<div class="refsect2">
1469
 
<a name="im-vips2png"></a><h3>im_vips2png ()</h3>
1470
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_vips2png                         (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1471
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
1472
 
<p>
1473
 
Write a VIPS image to a file as PNG.
1474
 
</p>
1475
 
<p>
1476
 
You can embed options in the filename. They have the form:
1477
 
</p>
1478
 
<p>
1479
 
</p>
1480
 
<div class="informalexample"><pre class="programlisting">
1481
 
filename.png:<span class="emphasis"><em>compression</em></span>,<span class="emphasis"><em>interlace</em></span>
1482
 
</pre></div>
1483
 
<p>
1484
 
</p>
1485
 
<p>
1486
 
</p>
1487
 
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
1488
 
<li class="listitem"><p>
1489
 
<span class="emphasis"><em>compression</em></span> 
1490
 
Compress with this much effort (0 - 9). Default 6.
1491
 
    </p></li>
1492
 
<li class="listitem"><p>
1493
 
<span class="emphasis"><em>interlace</em></span> 
1494
 
0 means don't interlace (the default), 1 selects ADAM7 interlacing. Beware
1495
 
than an interlaced PNG can be up to 7 times slower to write than a
1496
 
non-interlaced image.
1497
 
    </p></li>
1498
 
</ul></div>
1499
 
<p>
1500
 
</p>
1501
 
<p>
1502
 
There is no support for attaching ICC profiles to PNG images.
1503
 
</p>
1504
 
<p>
1505
 
The image is automatically converted to RGB, RGBA, Monochrome or Mono +
1506
 
alpha before saving. Images with more than one byte per band element are
1507
 
saved as 16-bit PNG, others are saved as 8-bit PNG.
1508
 
</p>
1509
 
<p>
1510
 
Example:
1511
 
</p>
1512
 
<p>
1513
 
</p>
1514
 
<div class="informalexample"><pre class="programlisting">
1515
 
im_vips2png( in, "fred.png:0,1" );
1516
 
</pre></div>
1517
 
<p>
1518
 
</p>
1519
 
<p>
1520
 
Will write "fred.png" with no compression and with ADAM7 interlacing.
1521
 
</p>
1522
 
<p>
1523
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-png2vips" title="im_png2vips ()"><code class="function">im_png2vips()</code></a>.
1524
 
</p>
1525
 
<div class="variablelist"><table border="0">
1526
 
<col align="left" valign="top">
1527
 
<tbody>
1528
 
<tr>
1529
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1530
 
<td>image to save</td>
1531
 
</tr>
1532
 
<tr>
1533
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1534
 
<td>file to write to</td>
1535
 
</tr>
1536
 
<tr>
1537
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1538
 
<td>0 on success, -1 on error.</td>
1539
 
</tr>
1540
 
</tbody>
1541
 
</table></div>
1542
 
</div>
1543
 
<hr>
1544
 
<div class="refsect2">
1545
 
<a name="im-vips2bufpng"></a><h3>im_vips2bufpng ()</h3>
1546
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_vips2bufpng                      (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1547
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
1548
 
                                                         <em class="parameter"><code><span class="type">int</span> compression</code></em>,
1549
 
                                                         <em class="parameter"><code><span class="type">int</span> interlace</code></em>,
1550
 
                                                         <em class="parameter"><code><span class="type">char</span> **obuf</code></em>,
1551
 
                                                         <em class="parameter"><code><span class="type">size_t</span> *olen</code></em>);</pre>
1552
 
<p>
1553
 
As <a class="link" href="VipsFormat.html#im-vips2png" title="im_vips2png ()"><code class="function">im_vips2png()</code></a>, but save as a memory buffer. The memory is allocated
1554
 
local to <em class="parameter"><code>out</code></em> (that is, when <em class="parameter"><code>out</code></em> is closed the memory will be released,
1555
 
pass <code class="literal">NULL</code> to release yourself). 
1556
 
</p>
1557
 
<p>
1558
 
The address of the buffer is returned in <em class="parameter"><code>obuf</code></em>, the length of the buffer in
1559
 
<em class="parameter"><code>olen</code></em>.
1560
 
</p>
1561
 
<p>
1562
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-vips2png" title="im_vips2png ()"><code class="function">im_vips2png()</code></a>.
1563
 
</p>
1564
 
<div class="variablelist"><table border="0">
1565
 
<col align="left" valign="top">
1566
 
<tbody>
1567
 
<tr>
1568
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1569
 
<td>image to save</td>
1570
 
</tr>
1571
 
<tr>
1572
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1573
 
<td>allocate output buffer local to this</td>
1574
 
</tr>
1575
 
<tr>
1576
 
<td><p><span class="term"><em class="parameter"><code>compression</code></em> :</span></p></td>
1577
 
<td>compress with this much effort</td>
1578
 
</tr>
1579
 
<tr>
1580
 
<td><p><span class="term"><em class="parameter"><code>interlace</code></em> :</span></p></td>
1581
 
<td>0 means don't interlace, 1 selects ADAM7 interlacing</td>
1582
 
</tr>
1583
 
<tr>
1584
 
<td><p><span class="term"><em class="parameter"><code>obuf</code></em> :</span></p></td>
1585
 
<td>return output buffer here</td>
1586
 
</tr>
1587
 
<tr>
1588
 
<td><p><span class="term"><em class="parameter"><code>olen</code></em> :</span></p></td>
1589
 
<td>return output length here</td>
1590
 
</tr>
1591
 
<tr>
1592
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1593
 
<td>0 on success, -1 on error.</td>
1594
 
</tr>
1595
 
</tbody>
1596
 
</table></div>
1597
 
</div>
1598
 
<hr>
1599
 
<div class="refsect2">
1600
 
<a name="im-raw2vips"></a><h3>im_raw2vips ()</h3>
1601
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_raw2vips                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1602
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
1603
 
                                                         <em class="parameter"><code><span class="type">int</span> width</code></em>,
1604
 
                                                         <em class="parameter"><code><span class="type">int</span> height</code></em>,
1605
 
                                                         <em class="parameter"><code><span class="type">int</span> bpp</code></em>,
1606
 
                                                         <em class="parameter"><code><span class="type">int</span> offset</code></em>);</pre>
1607
 
<p>
1608
 
This operation mmaps the file, setting <em class="parameter"><code>out</code></em> so that access to that 
1609
 
image will read from the file.
1610
 
</p>
1611
 
<p>
1612
 
Use functions like <a class="link" href="libvips-conversion.html#im-copy-morph" title="im_copy_morph ()"><code class="function">im_copy_morph()</code></a> to set the pixel type, byte ordering 
1613
 
and so on.
1614
 
</p>
1615
 
<p>
1616
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-vips2raw" title="im_vips2raw ()"><code class="function">im_vips2raw()</code></a>.
1617
 
</p>
1618
 
<div class="variablelist"><table border="0">
1619
 
<col align="left" valign="top">
1620
 
<tbody>
1621
 
<tr>
1622
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1623
 
<td>file to read</td>
1624
 
</tr>
1625
 
<tr>
1626
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1627
 
<td>image to write to</td>
1628
 
</tr>
1629
 
<tr>
1630
 
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
1631
 
<td>image width in pixels</td>
1632
 
</tr>
1633
 
<tr>
1634
 
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
1635
 
<td>image height in pixels</td>
1636
 
</tr>
1637
 
<tr>
1638
 
<td><p><span class="term"><em class="parameter"><code>bpp</code></em> :</span></p></td>
1639
 
<td>bytes per pixel</td>
1640
 
</tr>
1641
 
<tr>
1642
 
<td><p><span class="term"><em class="parameter"><code>offset</code></em> :</span></p></td>
1643
 
<td>skip this many bytes at the start of the file</td>
1644
 
</tr>
1645
 
<tr>
1646
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1647
 
<td>0 on success, -1 on error.</td>
1648
 
</tr>
1649
 
</tbody>
1650
 
</table></div>
1651
 
</div>
1652
 
<hr>
1653
 
<div class="refsect2">
1654
 
<a name="im-vips2raw"></a><h3>im_vips2raw ()</h3>
1655
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_vips2raw                         (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1656
 
                                                         <em class="parameter"><code><span class="type">int</span> fd</code></em>);</pre>
1657
 
<p>
1658
 
Writes the pixels in <em class="parameter"><code>in</code></em> to the file descriptor. It's handy for writing
1659
 
writers for other formats.
1660
 
</p>
1661
 
<p>
1662
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="VipsFormat.html#im-raw2vips" title="im_raw2vips ()"><code class="function">im_raw2vips()</code></a>.
1663
 
</p>
1664
 
<div class="variablelist"><table border="0">
1665
 
<col align="left" valign="top">
1666
 
<tbody>
1667
 
<tr>
1668
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1669
 
<td>image to save</td>
1670
 
</tr>
1671
 
<tr>
1672
 
<td><p><span class="term"><em class="parameter"><code>fd</code></em> :</span></p></td>
1673
 
<td>file descriptor to write to</td>
1674
 
</tr>
1675
 
<tr>
1676
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1677
 
<td>0 on success, -1 on error.</td>
1678
 
</tr>
1679
 
</tbody>
1680
 
</table></div>
1681
 
</div>
1682
 
<hr>
1683
 
<div class="refsect2">
1684
 
<a name="im-mat2vips"></a><h3>im_mat2vips ()</h3>
1685
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_mat2vips                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1686
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
1687
 
<p>
1688
 
Read a Matlab save file into a VIPS image. 
1689
 
</p>
1690
 
<p>
1691
 
This operation searches the save
1692
 
file for the first array variable with between 1 and 3 dimensions and loads
1693
 
it as an image. It will not handle complex images. It does not handle
1694
 
sparse matrices. 
1695
 
</p>
1696
 
<p>
1697
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>.
1698
 
</p>
1699
 
<div class="variablelist"><table border="0">
1700
 
<col align="left" valign="top">
1701
 
<tbody>
1702
 
<tr>
1703
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1704
 
<td>file to load</td>
1705
 
</tr>
1706
 
<tr>
1707
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1708
 
<td>image to write to</td>
1709
 
</tr>
1710
 
<tr>
1711
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1712
 
<td>0 on success, -1 on error.</td>
1713
 
</tr>
1714
 
</tbody>
1715
 
</table></div>
1716
 
</div>
1717
 
<hr>
1718
 
<div class="refsect2">
1719
 
<a name="im-rad2vips"></a><h3>im_rad2vips ()</h3>
1720
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_rad2vips                         (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1721
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
1722
 
<p>
1723
 
Read a Radiance (HDR) file into a VIPS image. 
1724
 
</p>
1725
 
<p>
1726
 
Radiance files are read as <span class="type">IM_CODING_RAD</span>. They have one byte for each of
1727
 
red, green and blue, and one byte of shared exponent. Some operations (like
1728
 
<a class="link" href="libvips-conversion.html#im-extract-area" title="im_extract_area ()"><code class="function">im_extract_area()</code></a>) can work directly with images in this format, but 
1729
 
mmany (all the arithmetic operations, for example) will not. unpack 
1730
 
<span class="type">IM_CODING_RAD</span> images to 3 band float with <a class="link" href="libvips-colour.html#im-rad2float" title="im_rad2float ()"><code class="function">im_rad2float()</code></a> if you want to do
1731
 
arithmetic on them.
1732
 
</p>
1733
 
<p>
1734
 
This operation ignores some header fields, like VIEW and DATE. It will not 
1735
 
rotate/flip as the FORMAT string asks.
1736
 
</p>
1737
 
<p>
1738
 
Sections of this reader from Greg Ward and Radiance with kind permission. 
1739
 
</p>
1740
 
<p>
1741
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="libvips-colour.html#im-rad2float" title="im_rad2float ()"><code class="function">im_rad2float()</code></a>, <a class="link" href="VipsFormat.html#im-vips2rad" title="im_vips2rad ()"><code class="function">im_vips2rad()</code></a>.
1742
 
</p>
1743
 
<div class="variablelist"><table border="0">
1744
 
<col align="left" valign="top">
1745
 
<tbody>
1746
 
<tr>
1747
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1748
 
<td>file to load</td>
1749
 
</tr>
1750
 
<tr>
1751
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1752
 
<td>image to write to</td>
1753
 
</tr>
1754
 
<tr>
1755
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1756
 
<td>0 on success, -1 on error.</td>
1757
 
</tr>
1758
 
</tbody>
1759
 
</table></div>
1760
 
</div>
1761
 
<hr>
1762
 
<div class="refsect2">
1763
 
<a name="im-vips2rad"></a><h3>im_vips2rad ()</h3>
1764
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_vips2rad                         (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1765
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
1766
 
<p>
1767
 
Write a VIPS image in Radiance (HDR) format.
1768
 
</p>
1769
 
<p>
1770
 
This operation needs an <span class="type">IM_CODING_RAD</span> image, or a three-band float image.
1771
 
</p>
1772
 
<p>
1773
 
Sections of this reader from Greg Ward and Radiance with kind permission. 
1774
 
</p>
1775
 
<p>
1776
 
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>, <a class="link" href="libvips-colour.html#im-float2rad" title="im_float2rad ()"><code class="function">im_float2rad()</code></a>, <a class="link" href="VipsFormat.html#im-rad2vips" title="im_rad2vips ()"><code class="function">im_rad2vips()</code></a>.
1777
 
</p>
1778
 
<div class="variablelist"><table border="0">
1779
 
<col align="left" valign="top">
1780
 
<tbody>
1781
 
<tr>
1782
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1783
 
<td>image to save</td>
1784
 
</tr>
1785
 
<tr>
1786
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1787
 
<td>file to write to</td>
1788
 
</tr>
1789
 
<tr>
1790
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1791
 
<td>0 on success, -1 on error.</td>
1792
 
</tr>
1793
 
</tbody>
1794
 
</table></div>
1795
 
</div>
1796
 
<hr>
1797
 
<div class="refsect2">
1798
 
<a name="im-fits2vips"></a><h3>im_fits2vips ()</h3>
1799
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_fits2vips                        (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1800
 
                                                         <em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
1801
 
<p>
1802
 
Read a FITS image file into a VIPS image. 
1803
 
</p>
1804
 
<p>
1805
 
See also: <a class="link" href="VipsFormat.html#im-vips2fits" title="im_vips2fits ()"><code class="function">im_vips2fits()</code></a>, <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>.
1806
 
</p>
1807
 
<div class="variablelist"><table border="0">
1808
 
<col align="left" valign="top">
1809
 
<tbody>
1810
 
<tr>
1811
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1812
 
<td>file to load</td>
1813
 
</tr>
1814
 
<tr>
1815
 
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1816
 
<td>image to write to</td>
1817
 
</tr>
1818
 
<tr>
1819
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1820
 
<td>0 on success, -1 on error.</td>
1821
 
</tr>
1822
 
</tbody>
1823
 
</table></div>
1824
 
</div>
1825
 
<hr>
1826
 
<div class="refsect2">
1827
 
<a name="im-vips2fits"></a><h3>im_vips2fits ()</h3>
1828
 
<pre class="programlisting"><span class="returnvalue">int</span>                 im_vips2fits                        (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1829
 
                                                         <em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
1830
 
<p>
1831
 
Write <em class="parameter"><code>in</code></em> to <em class="parameter"><code>filename</code></em> in FITS format. 
1832
 
</p>
1833
 
<p>
1834
 
See also: <a class="link" href="VipsFormat.html#im-fits2vips" title="im_fits2vips ()"><code class="function">im_fits2vips()</code></a>, <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>.
1835
 
</p>
1836
 
<div class="variablelist"><table border="0">
1837
 
<col align="left" valign="top">
1838
 
<tbody>
1839
 
<tr>
1840
 
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1841
 
<td>image to write</td>
1842
 
</tr>
1843
 
<tr>
1844
 
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1845
 
<td>file to write to</td>
1846
 
</tr>
1847
 
<tr>
1848
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1849
 
<td>0 on success, -1 on error.</td>
1850
 
</tr>
1851
 
</tbody>
1852
 
</table></div>
1853
 
</div>
1854
 
</div>
1855
 
<div class="refsect1">
1856
 
<a name="VipsFormat.see-also"></a><h2>See Also</h2>
1857
 
image
1858
 
</div>
1859
 
</div>
1860
 
<div class="footer">
1861
 
<hr>
1862
 
          Generated by GTK-Doc V1.17</div>
1863
 
</body>
1864
 
</html>
 
 
b'\\ No newline at end of file'