1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>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">
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
17
<td><a accesskey="p" href="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>
23
<tr><td colspan="5" class="shortcuts">
24
<a href="#VipsFormat.synopsis" class="shortcut">Top</a>
26
<a href="#VipsFormat.description" class="shortcut">Description</a>
28
<a href="#VipsFormat.object-hierarchy" class="shortcut">Object Hierarchy</a>
31
<div class="refentry">
32
<a name="VipsFormat"></a><div class="titlepage"></div>
33
<div class="refnamediv"><table width="100%"><tr>
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>
38
<td valign="top" align="right"></td>
40
<div class="refsect1">
41
<a name="VipsFormat.stability-level"></a><h2>Stability Level</h2>
42
Stable, unless otherwise indicated
44
<div class="refsynopsisdiv">
45
<a name="VipsFormat.synopsis"></a><h2>Synopsis</h2>
46
<pre class="synopsis">
47
#include <vips/vips.h>
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>);
131
<div class="refsect1">
132
<a name="VipsFormat.object-hierarchy"></a><h2>Object Hierarchy</h2>
133
<pre class="synopsis">
135
+----<a class="link" href="libvips-VipsArgument.html#VipsObject">VipsObject</a>
139
<div class="refsect1">
140
<a name="VipsFormat.description"></a><h2>Description</h2>
142
VIPS has a simple system for representing image load and save operations in
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.
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>.
156
VIPS comes with VipsFormat for TIFF, JPEG, PNG, Analyze, PPM, OpenEXR, CSV,
157
Matlab, Radiance, RAW, VIPS and one that wraps libMagick.
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 */
171
Some hints about the image loader.
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.
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>.
182
<div class="variablelist"><table border="0">
183
<col align="left" valign="top">
186
<td><p><a name="VIPS-FORMAT-NONE:CAPS"></a><span class="term"><code class="literal">VIPS_FORMAT_NONE</code></span></p></td>
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
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
204
<div class="refsect2">
205
<a name="VipsFormat-struct"></a><h3>VipsFormat</h3>
206
<pre class="programlisting">typedef struct _VipsFormat VipsFormat;</pre>
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:
213
<div class="informalexample"><pre class="programlisting">
214
typedef struct _VipsFormatClass {
215
VipsObjectClass parent_class;
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 );
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>.
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.
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>.
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.
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>.
255
define this method, you can still define <code class="function">save()</code> and have a save-only
257
Return 0 for success, -1 for error, setting
258
<code class="function">im_error()</code>.
260
<li class="listitem"><p>
261
<code class="function">save()</code> This function should save the image to the file.
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>.
265
define this method, you can still define <code class="function">load()</code> and have a load-only
267
Return 0 for success, -1 for error, setting
268
<code class="function">im_error()</code>.
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
275
<li class="listitem"><p>
276
<em class="structfield"><code>priority</code></em> Where this format should fit in this
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.
281
<li class="listitem">
283
<em class="structfield"><code>suffs</code></em> A <code class="literal">NULL</code>-terminated list of possible file
285
suffixes, for example:
287
<div class="informalexample"><pre class="programlisting">
288
static const char *tiff_suffs[] = { ".tif", ".tiff", NULL };
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>.
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>.
303
At the command-line, use:
307
<div class="informalexample"><pre class="programlisting">
308
vips --list classes | grep Format
313
To see a list of all the supported formats.
316
For example, the TIFF format is defined like this:
320
<div class="informalexample"><pre class="programlisting">
321
typedef VipsFormat VipsFormatTiff;
322
typedef VipsFormatClass VipsFormatTiffClass;
325
vips_format_tiff_class_init( VipsFormatTiffClass *class )
327
VipsObjectClass *object_class = (VipsObjectClass *) class;
328
VipsFormatClass *format_class = (VipsFormatClass *) class;
330
object_class->nickname = "tiff";
331
object_class->description = _( "TIFF" );
333
format_class->is_a = istiff;
334
format_class->header = tiff2vips_header;
335
format_class->load = im_tiff2vips;
336
format_class->save = im_vips2tiff;
337
format_class->get_flags = tiff_flags;
338
format_class->suffs = tiff_suffs;
342
vips_format_tiff_init( VipsFormatTiff *object )
346
G_DEFINE_TYPE( VipsFormatTiff, vips_format_tiff, VIPS_TYPE_FORMAT );
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
357
<div class="refsect2">
358
<a name="VipsFormatClass"></a><h3>VipsFormatClass</h3>
359
<pre class="programlisting">typedef struct {
360
VipsObjectClass parent_class;
362
/* Is a file in this format.
364
gboolean (*is_a)( const char * );
366
/* Read just the header into the VipsImage.
368
int (*header)( const char *, VipsImage * );
370
/* Load the whole image.
372
int (*load)( const char *, VipsImage * );
374
/* Write the VipsImage to the file in this format.
376
int (*save)( VipsImage *, const char * );
378
/* Get the flags for this file in this format.
380
VipsFormatFlags (*get_flags)( const char * );
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.
389
/* Null-terminated list of allowed suffixes, eg. ".tif", ".tiff".
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>
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.
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>.
411
See also: <code class="function">im_slist_map()</code>.
413
<div class="variablelist"><table border="0">
414
<col align="left" valign="top">
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>
422
<td><p><span class="term"><em class="parameter"><code>a</code></em> :</span></p></td>
426
<td><p><span class="term"><em class="parameter"><code>b</code></em> :</span></p></td>
430
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
431
<td>the result of iteration</td>
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>
441
Searches for a format you could use to load a file.
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>.
446
<div class="variablelist"><table border="0">
447
<col align="left" valign="top">
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>
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>
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>
465
Searches for a format you could use to save a file.
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>.
470
<div class="variablelist"><table border="0">
471
<col align="left" valign="top">
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>
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>
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>
490
Get a set of flags for this file.
492
<div class="variablelist"><table border="0">
493
<col align="left" valign="top">
496
<td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
497
<td>format to test</td>
500
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
501
<td>file to test</td>
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>
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>
516
Searches for a format for this file, then loads the file into <em class="parameter"><code>out</code></em>.
519
See also: <a class="link" href="VipsFormat.html#vips-format-write" title="vips_format_write ()"><code class="function">vips_format_write()</code></a>.
521
<div class="variablelist"><table border="0">
522
<col align="left" valign="top">
525
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
526
<td>file to load</td>
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>
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>
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>
545
Searches for a format for this name, then saves <em class="parameter"><code>im</code></em> to it.
548
See also: <a class="link" href="VipsFormat.html#vips-format-read" title="vips_format_read ()"><code class="function">vips_format_read()</code></a>.
550
<div class="variablelist"><table border="0">
551
<col align="left" valign="top">
554
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
555
<td>image to write</td>
558
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
559
<td>file to write to</td>
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>
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>
574
Read a JPEG file into a VIPS image. It can read most 8-bit JPEG images,
575
including CMYK and YCbCr.
578
You can embed options in the filename. They have the form:
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>
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.
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.
610
<div class="informalexample"><pre class="programlisting">
611
im_jpeg2vips( "fred.jpg:8" out );
612
im_jpeg2vips( "fred.jpg:,fail" out );
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.
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.
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
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>.
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>.
639
<div class="variablelist"><table border="0">
640
<col align="left" valign="top">
643
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
644
<td>file to load</td>
647
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
648
<td>image to write to</td>
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>
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>
665
Read a JPEG-formatted memory block into a VIPS image. It can read most
666
8-bit JPEG images, including CMYK and YCbCr.
669
This function is handy for processing JPEG image thumbnails.
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>.
674
<div class="variablelist"><table border="0">
675
<col align="left" valign="top">
678
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
679
<td>memory area to load</td>
682
<td><p><span class="term"><em class="parameter"><code>len</code></em> :</span></p></td>
683
<td>size of memory area</td>
686
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
687
<td>image to write</td>
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>
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>
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>
706
Write a VIPS image to a file as JPEG.
709
You can embed options in the filename. They have the form:
713
<div class="informalexample"><pre class="programlisting">
714
filename.jpg:<span class="emphasis"><em>compression</em></span>,<span class="emphasis"><em>profile</em></span>
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.
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".
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.
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.
750
<div class="informalexample"><pre class="programlisting">
751
im_vips2jpeg( in, "fred.jpg:99,none" );
756
Will write "fred.jpg" at high-quality with no ICC profile.
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>.
761
<div class="variablelist"><table border="0">
762
<col align="left" valign="top">
765
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
766
<td>image to save</td>
769
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
770
<td>file to write to</td>
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>
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>
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.
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>.
790
<div class="variablelist"><table border="0">
791
<col align="left" valign="top">
794
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
795
<td>image to save</td>
798
<td><p><span class="term"><em class="parameter"><code>qfac</code></em> :</span></p></td>
799
<td>JPEG quality factor</td>
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>
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>
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).
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 :-(
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>.
828
<div class="variablelist"><table border="0">
829
<col align="left" valign="top">
832
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
833
<td>image to save</td>
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>
840
<td><p><span class="term"><em class="parameter"><code>qfac</code></em> :</span></p></td>
841
<td>JPEG quality factor</td>
844
<td><p><span class="term"><em class="parameter"><code>obuf</code></em> :</span></p></td>
845
<td>return output buffer here</td>
848
<td><p><span class="term"><em class="parameter"><code>olen</code></em> :</span></p></td>
849
<td>return output length here</td>
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>
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>
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.
869
You can embed a page number in the filename. For example:
873
<div class="informalexample"><pre class="programlisting">
874
im_tiff2vips( "fred.tif:23", out );
879
Will read page 23. By default, the operation reads the first page.
882
Any ICC profile is read out and attached to the VIPS image.
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>.
887
<div class="variablelist"><table border="0">
888
<col align="left" valign="top">
891
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
892
<td>file to load</td>
895
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
896
<td>image to write to</td>
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>
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>
911
Write a VIPS image to a file as TIFF.
914
You can embed options in the filename. They have the form:
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>
925
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
926
<li class="listitem">
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).
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
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 > 8. Try it to find whether it
946
works for your images.
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.
954
<li class="listitem">
956
<span class="emphasis"><em>layout</em></span>
957
should be "strip" (strip layout) or "tile" (tiled layout).
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.
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".
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".
975
<li class="listitem">
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
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.
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
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.
1010
<div class="informalexample"><pre class="programlisting">
1011
im_vips2jpeg( in, "fred.tif:jpeg,tile,pyramid" );
1016
Will write "fred.tif" as a tiled jpeg-compressed pyramid.
1020
<div class="informalexample"><pre class="programlisting">
1021
im_vips2jpeg( in, "fred.tif:packbits,tile,,onebit" );
1026
Writes a tiled one bit TIFF image (provided fred.v is a one band 8 bit
1027
image) compressed with packbits.
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>.
1032
<div class="variablelist"><table border="0">
1033
<col align="left" valign="top">
1036
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1037
<td>image to save</td>
1040
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1041
<td>file to write to</td>
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>
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>
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>.
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.
1072
See also: <code class="function">im_cache()</code>.
1074
<div class="variablelist"><table border="0">
1075
<col align="left" valign="top">
1078
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1079
<td>input image</td>
1082
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1083
<td>output image</td>
1086
<td><p><span class="term"><em class="parameter"><code>tile_width</code></em> :</span></p></td>
1090
<td><p><span class="term"><em class="parameter"><code>tile_height</code></em> :</span></p></td>
1091
<td>tile height</td>
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>
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>
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>
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
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.
1118
The reader should also work with most versions of GraphicsMagick.
1121
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>.
1123
<div class="variablelist"><table border="0">
1124
<col align="left" valign="top">
1127
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1128
<td>file to load</td>
1131
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1132
<td>image to write to</td>
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>
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>
1147
Read a OpenEXR file into a VIPS image.
1150
The reader can handle scanline and tiled OpenEXR images. It can't handle
1151
OpenEXR colour management, image attributes, many pixel formats, anything
1155
This reader uses the rather limited OpenEXR C API. It should really be
1159
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>.
1161
<div class="variablelist"><table border="0">
1162
<col align="left" valign="top">
1165
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1166
<td>file to load</td>
1169
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1170
<td>image to write to</td>
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>
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>
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.
1191
PFM images have the scale factor attached as "pfm-scale".
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>
1196
<div class="variablelist"><table border="0">
1197
<col align="left" valign="top">
1200
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1201
<td>file to load</td>
1204
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1205
<td>image to write to</td>
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>
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>
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.
1226
When writing float (PFM) images the scale factor is set from the
1227
"pfm-scale" metadata.
1230
The storage format is indicated by a filename extension, for example:
1234
<div class="informalexample"><pre class="programlisting">
1235
im_vips2ppm( im, "fred.ppm:ascii" )
1240
will write to "fred.ppm" in ascii format. The default is binary.
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>.
1245
<div class="variablelist"><table border="0">
1246
<col align="left" valign="top">
1249
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1250
<td>image to save</td>
1253
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1254
<td>file to write to</td>
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>
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>
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".
1275
loaded lazilly and byte-swapped, if necessary. The Analyze metadata is read
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>.
1281
<div class="variablelist"><table border="0">
1282
<col align="left" valign="top">
1285
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1286
<td>file to load</td>
1289
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1290
<td>image to write to</td>
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>
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>
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
1312
Read options can be embedded in the filename. The options can be given
1313
in any order and are:
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.
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
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
1331
Whitespace characters are always run together.
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.
1346
<div class="informalexample"><pre class="programlisting">
1347
im_csv2vips( "fred.csv:skip:58,sep:\,,line:3", out );
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.
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>.
1358
<div class="variablelist"><table border="0">
1359
<col align="left" valign="top">
1362
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1363
<td>file to load</td>
1366
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1367
<td>image to write to</td>
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>
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>
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
1388
Write options can be embedded in the filename. The options can be given
1389
in any order and are:
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>
1405
<div class="informalexample"><pre class="programlisting">
1406
im_csv2vips( in, "fred.csv:sep:\t" );
1411
Will write to fred.csv, separating numbers with tab characters.
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>.
1416
<div class="variablelist"><table border="0">
1417
<col align="left" valign="top">
1420
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1421
<td>image to save</td>
1424
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1425
<td>file to write to</td>
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>
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>
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.
1444
There is no support for embedded ICC profiles.
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>.
1449
<div class="variablelist"><table border="0">
1450
<col align="left" valign="top">
1453
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1454
<td>file to load</td>
1457
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1458
<td>image to write to</td>
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>
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>
1473
Write a VIPS image to a file as PNG.
1476
You can embed options in the filename. They have the form:
1480
<div class="informalexample"><pre class="programlisting">
1481
filename.png:<span class="emphasis"><em>compression</em></span>,<span class="emphasis"><em>interlace</em></span>
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.
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.
1502
There is no support for attaching ICC profiles to PNG images.
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.
1514
<div class="informalexample"><pre class="programlisting">
1515
im_vips2png( in, "fred.png:0,1" );
1520
Will write "fred.png" with no compression and with ADAM7 interlacing.
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>.
1525
<div class="variablelist"><table border="0">
1526
<col align="left" valign="top">
1529
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1530
<td>image to save</td>
1533
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1534
<td>file to write to</td>
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>
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>
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).
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>.
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>.
1564
<div class="variablelist"><table border="0">
1565
<col align="left" valign="top">
1568
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1569
<td>image to save</td>
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>
1576
<td><p><span class="term"><em class="parameter"><code>compression</code></em> :</span></p></td>
1577
<td>compress with this much effort</td>
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>
1584
<td><p><span class="term"><em class="parameter"><code>obuf</code></em> :</span></p></td>
1585
<td>return output buffer here</td>
1588
<td><p><span class="term"><em class="parameter"><code>olen</code></em> :</span></p></td>
1589
<td>return output length here</td>
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>
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>
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.
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
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>.
1618
<div class="variablelist"><table border="0">
1619
<col align="left" valign="top">
1622
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1623
<td>file to read</td>
1626
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1627
<td>image to write to</td>
1630
<td><p><span class="term"><em class="parameter"><code>width</code></em> :</span></p></td>
1631
<td>image width in pixels</td>
1634
<td><p><span class="term"><em class="parameter"><code>height</code></em> :</span></p></td>
1635
<td>image height in pixels</td>
1638
<td><p><span class="term"><em class="parameter"><code>bpp</code></em> :</span></p></td>
1639
<td>bytes per pixel</td>
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>
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>
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>
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.
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>.
1664
<div class="variablelist"><table border="0">
1665
<col align="left" valign="top">
1668
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1669
<td>image to save</td>
1672
<td><p><span class="term"><em class="parameter"><code>fd</code></em> :</span></p></td>
1673
<td>file descriptor to write to</td>
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>
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>
1688
Read a Matlab save file into a VIPS image.
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
1697
See also: <a class="link" href="VipsFormat.html" title="VipsFormat"><span class="type">VipsFormat</span></a>.
1699
<div class="variablelist"><table border="0">
1700
<col align="left" valign="top">
1703
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1704
<td>file to load</td>
1707
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1708
<td>image to write to</td>
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>
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>
1723
Read a Radiance (HDR) file into a VIPS image.
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
1734
This operation ignores some header fields, like VIEW and DATE. It will not
1735
rotate/flip as the FORMAT string asks.
1738
Sections of this reader from Greg Ward and Radiance with kind permission.
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>.
1743
<div class="variablelist"><table border="0">
1744
<col align="left" valign="top">
1747
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1748
<td>file to load</td>
1751
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1752
<td>image to write to</td>
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>
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>
1767
Write a VIPS image in Radiance (HDR) format.
1770
This operation needs an <span class="type">IM_CODING_RAD</span> image, or a three-band float image.
1773
Sections of this reader from Greg Ward and Radiance with kind permission.
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>.
1778
<div class="variablelist"><table border="0">
1779
<col align="left" valign="top">
1782
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1783
<td>image to save</td>
1786
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1787
<td>file to write to</td>
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>
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>
1802
Read a FITS image file into a VIPS image.
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>.
1807
<div class="variablelist"><table border="0">
1808
<col align="left" valign="top">
1811
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1812
<td>file to load</td>
1815
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1816
<td>image to write to</td>
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>
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>
1831
Write <em class="parameter"><code>in</code></em> to <em class="parameter"><code>filename</code></em> in FITS format.
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>.
1836
<div class="variablelist"><table border="0">
1837
<col align="left" valign="top">
1840
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1841
<td>image to write</td>
1844
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1845
<td>file to write to</td>
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>
1855
<div class="refsect1">
1856
<a name="VipsFormat.see-also"></a><h2>See Also</h2>
1860
<div class="footer">
1862
Generated by GTK-Doc V1.17</div>
b'\\ No newline at end of file'