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>VipsForeign</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
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-freqfilt.html" title="freqfilt">
11
<meta name="generator" content="GTK-Doc V1.19 (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-freqfilt.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="#VipsForeign.synopsis" class="shortcut">Top</a>
26
<a href="#VipsForeign.description" class="shortcut">Description</a>
28
<a href="#VipsForeign.object-hierarchy" class="shortcut">Object Hierarchy</a>
30
<a href="#VipsForeign.properties" class="shortcut">Properties</a>
33
<div class="refentry">
34
<a name="VipsForeign"></a><div class="titlepage"></div>
35
<div class="refnamediv"><table width="100%"><tr>
37
<h2><span class="refentrytitle"><a name="VipsForeign.top_of_page"></a>VipsForeign</span></h2>
38
<p>VipsForeign — load and save images in a variety of formats</p>
40
<td valign="top" align="right"></td>
42
<div class="refsect1">
43
<a name="VipsForeign.stability-level"></a><h2>Stability Level</h2>
44
Stable, unless otherwise indicated
46
<div class="refsynopsisdiv">
47
<a name="VipsForeign.synopsis"></a><h2>Synopsis</h2>
48
<a name="VipsForeignLoad"></a><a name="VipsForeignSave"></a><pre class="synopsis">
49
#include <vips/vips.h>
51
<a class="link" href="VipsForeign.html#VipsForeign-struct" title="VipsForeign">VipsForeign</a>;
52
<a class="link" href="VipsForeign.html#VipsForeignClass" title="VipsForeignClass">VipsForeignClass</a>;
53
<span class="returnvalue">void</span> * <a class="link" href="VipsForeign.html#vips-foreign-map" title="vips_foreign_map ()">vips_foreign_map</a> (<em class="parameter"><code>const <span class="type">char</span> *base</code></em>,
54
<em class="parameter"><code><span class="type">VipsSListMap2Fn</span> fn</code></em>,
55
<em class="parameter"><code><span class="type">void</span> *a</code></em>,
56
<em class="parameter"><code><span class="type">void</span> *b</code></em>);
57
enum <a class="link" href="VipsForeign.html#VipsForeignFlags" title="enum VipsForeignFlags">VipsForeignFlags</a>;
58
<a class="link" href="VipsForeign.html#VipsForeignLoad-struct" title="VipsForeignLoad">VipsForeignLoad</a>;
59
<a class="link" href="VipsForeign.html#VipsForeignLoadClass" title="VipsForeignLoadClass">VipsForeignLoadClass</a>;
60
const <span class="returnvalue">char</span> * <a class="link" href="VipsForeign.html#vips-foreign-find-load" title="vips_foreign_find_load ()">vips_foreign_find_load</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
61
const <span class="returnvalue">char</span> * <a class="link" href="VipsForeign.html#vips-foreign-find-load-options" title="vips_foreign_find_load_options ()">vips_foreign_find_load_options</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
62
<a class="link" href="VipsForeign.html#VipsForeignFlags" title="enum VipsForeignFlags"><span class="returnvalue">VipsForeignFlags</span></a> <a class="link" href="VipsForeign.html#vips-foreign-flags" title="vips_foreign_flags ()">vips_foreign_flags</a> (<em class="parameter"><code>const <span class="type">char</span> *loader</code></em>,
63
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
64
<span class="returnvalue">gboolean</span> <a class="link" href="VipsForeign.html#vips-foreign-is-a" title="vips_foreign_is_a ()">vips_foreign_is_a</a> (<em class="parameter"><code>const <span class="type">char</span> *loader</code></em>,
65
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
66
enum <a class="link" href="VipsForeign.html#VipsSaveable" title="enum VipsSaveable">VipsSaveable</a>;
67
<a class="link" href="VipsForeign.html#VipsForeignSave-struct" title="VipsForeignSave">VipsForeignSave</a>;
68
<a class="link" href="VipsForeign.html#VipsForeignSaveClass" title="VipsForeignSaveClass">VipsForeignSaveClass</a>;
69
const <span class="returnvalue">char</span> * <a class="link" href="VipsForeign.html#vips-foreign-find-save" title="vips_foreign_find_save ()">vips_foreign_find_save</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
70
const <span class="returnvalue">char</span> * <a class="link" href="VipsForeign.html#vips-foreign-find-save-options" title="vips_foreign_find_save_options ()">vips_foreign_find_save_options</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
71
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-foreign-load" title="vips_foreign_load ()">vips_foreign_load</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
72
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
73
<em class="parameter"><code>...</code></em>);
74
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-foreign-save" title="vips_foreign_save ()">vips_foreign_save</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
75
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
76
<em class="parameter"><code>...</code></em>);
77
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-foreign-load-options" title="vips_foreign_load_options ()">vips_foreign_load_options</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
78
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
79
<em class="parameter"><code>...</code></em>);
80
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-foreign-save-options" title="vips_foreign_save_options ()">vips_foreign_save_options</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
<em class="parameter"><code>...</code></em>);
83
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-openslideload" title="vips_openslideload ()">vips_openslideload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
84
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
85
<em class="parameter"><code>...</code></em>);
86
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-jpegload" title="vips_jpegload ()">vips_jpegload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
87
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
88
<em class="parameter"><code>...</code></em>);
89
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-jpegload-buffer" title="vips_jpegload_buffer ()">vips_jpegload_buffer</a> (<em class="parameter"><code><span class="type">void</span> *buf</code></em>,
90
<em class="parameter"><code><span class="type">size_t</span> len</code></em>,
91
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
92
<em class="parameter"><code>...</code></em>);
93
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-jpegsave" title="vips_jpegsave ()">vips_jpegsave</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
<em class="parameter"><code>...</code></em>);
96
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-jpegsave-buffer" title="vips_jpegsave_buffer ()">vips_jpegsave_buffer</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
97
<em class="parameter"><code><span class="type">void</span> **buf</code></em>,
98
<em class="parameter"><code><span class="type">size_t</span> *len</code></em>,
99
<em class="parameter"><code>...</code></em>);
100
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-jpegsave-mime" title="vips_jpegsave_mime ()">vips_jpegsave_mime</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
101
<em class="parameter"><code>...</code></em>);
102
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-webpload" title="vips_webpload ()">vips_webpload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
103
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
104
<em class="parameter"><code>...</code></em>);
105
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-webpload-buffer" title="vips_webpload_buffer ()">vips_webpload_buffer</a> (<em class="parameter"><code><span class="type">void</span> *buf</code></em>,
106
<em class="parameter"><code><span class="type">size_t</span> len</code></em>,
107
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
108
<em class="parameter"><code>...</code></em>);
109
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-webpsave" title="vips_webpsave ()">vips_webpsave</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
110
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
111
<em class="parameter"><code>...</code></em>);
112
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-webpsave-buffer" title="vips_webpsave_buffer ()">vips_webpsave_buffer</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
113
<em class="parameter"><code><span class="type">void</span> **buf</code></em>,
114
<em class="parameter"><code><span class="type">size_t</span> *len</code></em>,
115
<em class="parameter"><code>...</code></em>);
116
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-webpsave-mime" title="vips_webpsave_mime ()">vips_webpsave_mime</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
117
<em class="parameter"><code>...</code></em>);
118
enum <a class="link" href="VipsForeign.html#VipsForeignTiffCompression" title="enum VipsForeignTiffCompression">VipsForeignTiffCompression</a>;
119
enum <a class="link" href="VipsForeign.html#VipsForeignTiffPredictor" title="enum VipsForeignTiffPredictor">VipsForeignTiffPredictor</a>;
120
enum <a class="link" href="VipsForeign.html#VipsForeignTiffResunit" title="enum VipsForeignTiffResunit">VipsForeignTiffResunit</a>;
121
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-tiffload" title="vips_tiffload ()">vips_tiffload</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
<em class="parameter"><code>...</code></em>);
124
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-tiffsave" title="vips_tiffsave ()">vips_tiffsave</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
125
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
126
<em class="parameter"><code>...</code></em>);
127
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-openexrload" title="vips_openexrload ()">vips_openexrload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
128
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
129
<em class="parameter"><code>...</code></em>);
130
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-fitsload" title="vips_fitsload ()">vips_fitsload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
131
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
132
<em class="parameter"><code>...</code></em>);
133
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-fitssave" title="vips_fitssave ()">vips_fitssave</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
134
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
135
<em class="parameter"><code>...</code></em>);
136
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-analyzeload" title="vips_analyzeload ()">vips_analyzeload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
137
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
138
<em class="parameter"><code>...</code></em>);
139
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-rawload" title="vips_rawload ()">vips_rawload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
140
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
141
<em class="parameter"><code><span class="type">int</span> width</code></em>,
142
<em class="parameter"><code><span class="type">int</span> height</code></em>,
143
<em class="parameter"><code><span class="type">int</span> bands</code></em>,
144
<em class="parameter"><code>...</code></em>);
145
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-rawsave" title="vips_rawsave ()">vips_rawsave</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
146
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
147
<em class="parameter"><code>...</code></em>);
148
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-rawsave-fd" title="vips_rawsave_fd ()">vips_rawsave_fd</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
149
<em class="parameter"><code><span class="type">int</span> fd</code></em>,
150
<em class="parameter"><code>...</code></em>);
151
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-csvload" title="vips_csvload ()">vips_csvload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
152
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
153
<em class="parameter"><code>...</code></em>);
154
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-csvsave" title="vips_csvsave ()">vips_csvsave</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
155
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
156
<em class="parameter"><code>...</code></em>);
157
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-matrixload" title="vips_matrixload ()">vips_matrixload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
158
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
159
<em class="parameter"><code>...</code></em>);
160
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-matrixsave" title="vips_matrixsave ()">vips_matrixsave</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
161
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
162
<em class="parameter"><code>...</code></em>);
163
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-matrixprint" title="vips_matrixprint ()">vips_matrixprint</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
164
<em class="parameter"><code>...</code></em>);
165
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-magickload" title="vips_magickload ()">vips_magickload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
166
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
167
<em class="parameter"><code>...</code></em>);
168
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-pngload" title="vips_pngload ()">vips_pngload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
169
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
170
<em class="parameter"><code>...</code></em>);
171
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-pngload-buffer" title="vips_pngload_buffer ()">vips_pngload_buffer</a> (<em class="parameter"><code><span class="type">void</span> *buf</code></em>,
172
<em class="parameter"><code><span class="type">size_t</span> len</code></em>,
173
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
174
<em class="parameter"><code>...</code></em>);
175
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-pngsave" title="vips_pngsave ()">vips_pngsave</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
176
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
177
<em class="parameter"><code>...</code></em>);
178
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-pngsave-buffer" title="vips_pngsave_buffer ()">vips_pngsave_buffer</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
179
<em class="parameter"><code><span class="type">void</span> **buf</code></em>,
180
<em class="parameter"><code><span class="type">size_t</span> *len</code></em>,
181
<em class="parameter"><code>...</code></em>);
182
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-ppmload" title="vips_ppmload ()">vips_ppmload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
183
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
184
<em class="parameter"><code>...</code></em>);
185
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-ppmsave" title="vips_ppmsave ()">vips_ppmsave</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
186
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
187
<em class="parameter"><code>...</code></em>);
188
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-matload" title="vips_matload ()">vips_matload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
189
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
190
<em class="parameter"><code>...</code></em>);
191
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-radload" title="vips_radload ()">vips_radload</a> (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
192
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
193
<em class="parameter"><code>...</code></em>);
194
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-radsave" title="vips_radsave ()">vips_radsave</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
195
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
196
<em class="parameter"><code>...</code></em>);
197
enum <a class="link" href="VipsForeign.html#VipsForeignDzLayout" title="enum VipsForeignDzLayout">VipsForeignDzLayout</a>;
198
enum <a class="link" href="VipsForeign.html#VipsForeignDzDepth" title="enum VipsForeignDzDepth">VipsForeignDzDepth</a>;
199
<span class="returnvalue">int</span> <a class="link" href="VipsForeign.html#vips-dzsave" title="vips_dzsave ()">vips_dzsave</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
200
<em class="parameter"><code>const <span class="type">char</span> *basename</code></em>,
201
<em class="parameter"><code>...</code></em>);
204
<div class="refsect1">
205
<a name="VipsForeign.object-hierarchy"></a><h2>Object Hierarchy</h2>
206
<pre class="synopsis">
208
+----<a class="link" href="libvips-VipsArgument.html#VipsObject">VipsObject</a>
209
+----<a class="link" href="VipsOperation.html" title="VipsOperation">VipsOperation</a>
211
+----<a class="link" href="VipsForeign.html#VipsForeignLoad">VipsForeignLoad</a>
212
+----<a class="link" href="VipsForeign.html#VipsForeignSave">VipsForeignSave</a>
214
<pre class="synopsis">
216
+----<a class="link" href="libvips-VipsArgument.html#VipsObject">VipsObject</a>
217
+----<a class="link" href="VipsOperation.html" title="VipsOperation">VipsOperation</a>
218
+----<a class="link" href="VipsForeign.html" title="VipsForeign">VipsForeign</a>
221
<pre class="synopsis">
223
+----<a class="link" href="libvips-VipsArgument.html#VipsObject">VipsObject</a>
224
+----<a class="link" href="VipsOperation.html" title="VipsOperation">VipsOperation</a>
225
+----<a class="link" href="VipsForeign.html" title="VipsForeign">VipsForeign</a>
229
<div class="refsect1">
230
<a name="VipsForeign.properties"></a><h2>Properties</h2>
231
<pre class="synopsis">
232
"<a class="link" href="VipsForeign.html#VipsForeignLoad--access" title='The "access" property'>access</a>" <a class="link" href="VipsImage.html#VipsAccess" title="enum VipsAccess"><span class="type">VipsAccess</span></a> : Read / Write
233
"<a class="link" href="VipsForeign.html#VipsForeignLoad--disc" title='The "disc" property'>disc</a>" <span class="type">gboolean</span> : Read / Write
234
"<a class="link" href="VipsForeign.html#VipsForeignLoad--flags" title='The "flags" property'>flags</a>" <a class="link" href="VipsForeign.html#VipsForeignFlags" title="enum VipsForeignFlags"><span class="type">VipsForeignFlags</span></a> : Read / Write
235
"<a class="link" href="VipsForeign.html#VipsForeignLoad--out" title='The "out" property'>out</a>" <a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a>* : Read / Write
236
"<a class="link" href="VipsForeign.html#VipsForeignLoad--sequential" title='The "sequential" property'>sequential</a>" <span class="type">gboolean</span> : Read / Write
237
"<a class="link" href="VipsForeign.html#VipsForeignSave--in" title='The "in" property'>in</a>" <a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a>* : Read / Write
238
"<a class="link" href="VipsForeign.html#VipsForeignSave--strip" title='The "strip" property'>strip</a>" <span class="type">gboolean</span> : Read / Write
241
<div class="refsect1">
242
<a name="VipsForeign.description"></a><h2>Description</h2>
244
This set of operations load and save images in a variety of formats.
247
The operations share a base class that offers a simple way to search for a
248
subclass of <a class="link" href="VipsForeign.html" title="VipsForeign"><span class="type">VipsForeign</span></a> which can load a certain file (see
249
<a class="link" href="VipsForeign.html#vips-foreign-find-load" title="vips_foreign_find_load ()"><code class="function">vips_foreign_find_load()</code></a>) or which could be used to save an image to a
250
certain file type (see <a class="link" href="VipsForeign.html#vips-foreign-find-save" title="vips_foreign_find_save ()"><code class="function">vips_foreign_find_save()</code></a>). You can then run these
251
operations using <a class="link" href="VipsOperation.html#vips-call" title="vips_call ()"><code class="function">vips_call()</code></a> and friends to perform the load or save.
254
A pair of convenience
255
functions, <a class="link" href="VipsForeign.html#vips-foreign-load" title="vips_foreign_load ()"><code class="function">vips_foreign_load()</code></a> and <a class="link" href="VipsForeign.html#vips-foreign-save" title="vips_foreign_save ()"><code class="function">vips_foreign_save()</code></a>, automate the
256
process, loading an image from a file or saving an image to a file. These
257
functions let you give load or save options as name - value pairs in the C
258
argument list. You can use <a class="link" href="VipsForeign.html#vips-foreign-load-options" title="vips_foreign_load_options ()"><code class="function">vips_foreign_load_options()</code></a> and
259
<a class="link" href="VipsForeign.html#vips-foreign-save-options" title="vips_foreign_save_options ()"><code class="function">vips_foreign_save_options()</code></a> to include options in the file name.
266
<div class="informalexample"><pre class="programlisting">
267
vips_foreign_save (my_image, "frank.tiff",
268
"compression", VIPS_FOREIGN_TIFF_COMPRESSION_JPEG,
274
Will save an image to the file "frank.tiff" in TIFF format (selected by
275
the file name extension) with JPEG compression.
279
<div class="informalexample"><pre class="programlisting">
280
vips_foreign_save_options (my_image, "frank.tiff[compression=jpeg]");
285
Is the same thing, but with the option in the filename.
288
You can also invoke the operations directly, for example:
292
<div class="informalexample"><pre class="programlisting">
293
vips_tiffsave (my_image, "frank.anything",
294
"compression", VIPS_FOREIGN_TIFF_COMPRESSION_JPEG,
300
To add support for a new file format to vips, simply define a new subclass
301
of <a class="link" href="VipsForeign.html#VipsForeignLoad"><span class="type">VipsForeignLoad</span></a> or <a class="link" href="VipsForeign.html#VipsForeignSave"><span class="type">VipsForeignSave</span></a>.
304
If you define a new operation which is a subclass of <a class="link" href="VipsForeign.html" title="VipsForeign"><span class="type">VipsForeign</span></a>, support
305
for it automatically appears in all VIPS user-interfaces. It will also be
306
transparently supported by <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a> and friends.
309
VIPS comes with VipsForeign for TIFF, JPEG, PNG, Analyze, PPM, OpenEXR, CSV,
310
Matlab, Radiance, RAW, FITS and VIPS. It also
311
includes import filters which can
312
load with libMagick and with OpenSlide.
315
<div class="refsect1">
316
<a name="VipsForeign.details"></a><h2>Details</h2>
317
<div class="refsect2">
318
<a name="VipsForeign-struct"></a><h3>VipsForeign</h3>
319
<pre class="programlisting">typedef struct _VipsForeign VipsForeign;</pre>
324
<div class="refsect2">
325
<a name="VipsForeignClass"></a><h3>VipsForeignClass</h3>
326
<pre class="programlisting">typedef struct {
327
VipsOperationClass parent_class;
330
/* Loop over formats in this order, default 0. We need this because
331
* some formats can be read by several loaders (eg. tiff can be read
332
* by the libMagick loader as well as by the tiff loader), and we want
333
* to make sure the better loader comes first.
337
/* Null-terminated list of recommended suffixes, eg. ".tif", ".tiff".
338
* This can be used by both load and save, so it's in the base class.
344
The suffix list is used to select a format to save a file in, and to pick a
345
loader if you don't define <code class="function">is_a()</code>.
348
You should also define <em class="parameter"><code>nickname</code></em> and <em class="parameter"><code>description</code></em> in <a class="link" href="libvips-VipsArgument.html#VipsObject"><span class="type">VipsObject</span></a>.
352
<div class="refsect2">
353
<a name="vips-foreign-map"></a><h3>vips_foreign_map ()</h3>
354
<pre class="programlisting"><span class="returnvalue">void</span> * vips_foreign_map (<em class="parameter"><code>const <span class="type">char</span> *base</code></em>,
355
<em class="parameter"><code><span class="type">VipsSListMap2Fn</span> fn</code></em>,
356
<em class="parameter"><code><span class="type">void</span> *a</code></em>,
357
<em class="parameter"><code><span class="type">void</span> *b</code></em>);</pre>
359
Apply a function to every <a class="link" href="VipsForeign.html#VipsForeignClass" title="VipsForeignClass"><span class="type">VipsForeignClass</span></a> that VIPS knows about. Foreigns
360
are presented to the function in priority order.
363
Like all VIPS map functions, if <em class="parameter"><code>fn</code></em> returns <code class="literal">NULL</code>, iteration continues. If
364
it returns non-<code class="literal">NULL</code>, iteration terminates and that value is returned. The
365
map function returns <code class="literal">NULL</code> if all calls return <code class="literal">NULL</code>.
368
See also: <code class="function">vips_slist_map()</code>.
370
<div class="variablelist"><table border="0" class="variablelist">
372
<col align="left" valign="top">
377
<td><p><span class="term"><em class="parameter"><code>base</code></em> :</span></p></td>
378
<td>base class to search below (eg. "VipsForeignLoad")</td>
381
<td><p><span class="term"><em class="parameter"><code>fn</code></em> :</span></p></td>
382
<td>function to apply to each <a class="link" href="VipsForeign.html#VipsForeignClass" title="VipsForeignClass"><span class="type">VipsForeignClass</span></a>. <span class="annotation">[<acronym title="The callback is valid only during the call to the method."><span class="acronym">scope call</span></acronym>]</span>
386
<td><p><span class="term"><em class="parameter"><code>a</code></em> :</span></p></td>
390
<td><p><span class="term"><em class="parameter"><code>b</code></em> :</span></p></td>
394
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
395
<td>the result of iteration. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
402
<div class="refsect2">
403
<a name="VipsForeignFlags"></a><h3>enum VipsForeignFlags</h3>
404
<pre class="programlisting">typedef enum {
405
VIPS_FOREIGN_NONE = 0, /* No flags set */
406
VIPS_FOREIGN_PARTIAL = 1, /* Lazy read OK (eg. tiled tiff) */
407
VIPS_FOREIGN_BIGENDIAN = 2, /* Most-significant byte first */
408
VIPS_FOREIGN_SEQUENTIAL = 4, /* Top-to-bottom lazy read OK */
409
VIPS_FOREIGN_ALL = 7 /* All flags set */
413
Some hints about the image loader.
416
<em class="parameter"><code>VIPS_FOREIGN_PARTIAL</code></em> means that the image can be read directly from the
417
file without needing to be unpacked to a temporary image first.
420
<em class="parameter"><code>VIPS_FOREIGN_SEQUENTIAL</code></em> means that the loader supports lazy reading, but
421
only top-to-bottom (sequential) access. Formats like PNG can read sets of
422
scanlines, for example, but only in order.
425
If neither PARTIAL or SEQUENTIAL is set, the loader only supports whole
426
image read. Setting both PARTIAL and SEQUENTIAL is an error.
429
<em class="parameter"><code>VIPS_FOREIGN_BIGENDIAN</code></em> means that image pixels are most-significant byte
430
first. Depending on the native byte order of the host machine, you may
431
need to swap bytes. See <a class="link" href="libvips-conversion.html#vips-copy" title="vips_copy ()"><code class="function">vips_copy()</code></a>.
433
<div class="variablelist"><table border="0" class="variablelist">
435
<col align="left" valign="top">
440
<td><p><a name="VIPS-FOREIGN-NONE:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_NONE</code></span></p></td>
445
<td><p><a name="VIPS-FOREIGN-PARTIAL:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_PARTIAL</code></span></p></td>
446
<td>the image may be read lazilly
450
<td><p><a name="VIPS-FOREIGN-BIGENDIAN:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_BIGENDIAN</code></span></p></td>
451
<td>image pixels are most-significant byte first
455
<td><p><a name="VIPS-FOREIGN-SEQUENTIAL:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_SEQUENTIAL</code></span></p></td>
456
<td>top-to-bottom lazy reading
460
<td><p><a name="VIPS-FOREIGN-ALL:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_ALL</code></span></p></td>
468
<div class="refsect2">
469
<a name="VipsForeignLoad-struct"></a><h3>VipsForeignLoad</h3>
470
<pre class="programlisting">typedef struct {
471
/* The image we generate. This must be set by ->header().
475
/* The behind-the-scenes real image we decompress to. This can be a
476
* disc foreign or a memory buffer. This must be set by ->load().
480
/* Set this to tag the operation as nocache.
486
<em class="parameter"><code><code class="function">header()</code></code></em> must set at least the header fields of <em class="parameter"><code>out</code></em>. <em class="parameter"><code><code class="function">laod()</code></code></em>, if defined,
487
must load the pixels to <em class="parameter"><code>real</code></em>.
491
<div class="refsect2">
492
<a name="VipsForeignLoadClass"></a><h3>VipsForeignLoadClass</h3>
493
<pre class="programlisting">typedef struct {
494
VipsForeignClass parent_class;
496
/* Is a file in this format.
498
* This function should return %TRUE if the file contains an image of
499
* this type. If you don't define this function, #VipsForeignLoad
500
* will use @suffs instead.
502
gboolean (*is_a)( const char * );
504
/* Get the flags from a filename.
506
* This function should examine the file and return a set
507
* of flags. If you don't define it, vips will default to 0 (no flags
510
* This operation is necessary for vips7 compatibility.
512
VipsForeignFlags (*get_flags_filename)( const char * );
514
/* Get the flags for this load operation. Images can be loaded from
515
* (for example) memory areas rather than files, so you can't just use
516
* @get_flags_filename().
518
VipsForeignFlags (*get_flags)( VipsForeignLoad * );
520
/* Do the minimum read we can.
522
* Set the header fields in @out from @filename. If you can read the
523
* whole image as well with no performance cost (as with vipsload),
524
* or if your loader does not support reading only the header, read
525
* the entire image in this method and leave @load() NULL.
527
* @header() needs to set the dhint on the image .. otherwise you get
528
* the default SMALLTILE.
530
* Return 0 for success, -1 for error, setting
533
int (*header)( VipsForeignLoad * );
535
/* Read the whole image into @real. The pixels will get copied to @out
538
* You can omit this method if you define a @header() method which
539
* loads the whole file.
541
* Return 0 for success, -1 for error, setting
544
int (*load)( VipsForeignLoad * );
545
} VipsForeignLoadClass;
548
Add a new loader to VIPS by subclassing <a class="link" href="VipsForeign.html#VipsForeignLoad"><span class="type">VipsForeignLoad</span></a>. Subclasses need to
549
implement at least <em class="parameter"><code><code class="function">header()</code></code></em>.
552
As a complete example, here's the code for the PNG loader, minus the actual
557
<div class="informalexample"><pre class="programlisting">
558
typedef struct _VipsForeignLoadPng {
559
VipsForeignLoad parent_object;
562
} VipsForeignLoadPng;
564
typedef VipsForeignLoadClass VipsForeignLoadPngClass;
566
G_DEFINE_TYPE( VipsForeignLoadPng, vips_foreign_load_png,
567
VIPS_TYPE_FOREIGN_LOAD );
569
static VipsForeignFlags
570
vips_foreign_load_png_get_flags_filename( const char *filename )
572
VipsForeignFlags flags;
575
if( vips__png_isinterlaced( filename ) )
576
flags = VIPS_FOREIGN_PARTIAL;
578
flags = VIPS_FOREIGN_SEQUENTIAL;
583
static VipsForeignFlags
584
vips_foreign_load_png_get_flags( VipsForeignLoad *load )
586
VipsForeignLoadPng *png = (VipsForeignLoadPng *) load;
588
return( vips_foreign_load_png_get_flags_filename( png->filename ) );
592
vips_foreign_load_png_header( VipsForeignLoad *load )
594
VipsForeignLoadPng *png = (VipsForeignLoadPng *) load;
596
if( vips__png_header( png->filename, load->out ) )
603
vips_foreign_load_png_load( VipsForeignLoad *load )
605
VipsForeignLoadPng *png = (VipsForeignLoadPng *) load;
607
if( vips__png_read( png->filename, load->real ) )
614
vips_foreign_load_png_class_init( VipsForeignLoadPngClass *class )
616
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
617
VipsObjectClass *object_class = (VipsObjectClass *) class;
618
VipsForeignClass *foreign_class = (VipsForeignClass *) class;
619
VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class;
621
gobject_class->set_property = vips_object_set_property;
622
gobject_class->get_property = vips_object_get_property;
624
object_class->nickname = "pngload";
625
object_class->description = _( "load png from file" );
627
foreign_class->suffs = vips__png_suffs;
629
load_class->is_a = vips__png_ispng;
630
load_class->get_flags_filename =
631
vips_foreign_load_png_get_flags_filename;
632
load_class->get_flags = vips_foreign_load_png_get_flags;
633
load_class->header = vips_foreign_load_png_header;
634
load_class->load = vips_foreign_load_png_load;
636
VIPS_ARG_STRING( class, "filename", 1,
638
_( "Filename to load from" ),
639
VIPS_ARGUMENT_REQUIRED_INPUT,
640
G_STRUCT_OFFSET( VipsForeignLoadPng, filename ),
645
vips_foreign_load_png_init( VipsForeignLoadPng *png )
653
<div class="refsect2">
654
<a name="vips-foreign-find-load"></a><h3>vips_foreign_find_load ()</h3>
655
<pre class="programlisting">const <span class="returnvalue">char</span> * vips_foreign_find_load (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
657
Searches for an operation you could use to load <em class="parameter"><code>filename</code></em>.
660
See also: <code class="function">vips_foreign_read()</code>.
662
<div class="variablelist"><table border="0" class="variablelist">
664
<col align="left" valign="top">
669
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
670
<td>file to find a loader for</td>
673
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
674
<td>the name of an operation on success, <code class="literal">NULL</code> on error</td>
680
<div class="refsect2">
681
<a name="vips-foreign-find-load-options"></a><h3>vips_foreign_find_load_options ()</h3>
682
<pre class="programlisting">const <span class="returnvalue">char</span> * vips_foreign_find_load_options (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
684
Searches for an operation you could use to load <em class="parameter"><code>filename</code></em>.
687
Arguments to the loader may be embedded in the filename using the usual
691
See also: <a class="link" href="VipsForeign.html#vips-foreign-load" title="vips_foreign_load ()"><code class="function">vips_foreign_load()</code></a>.
693
<div class="variablelist"><table border="0" class="variablelist">
695
<col align="left" valign="top">
700
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
701
<td>file to find a loader for</td>
704
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
705
<td>0 on success, -1 on error</td>
711
<div class="refsect2">
712
<a name="vips-foreign-flags"></a><h3>vips_foreign_flags ()</h3>
713
<pre class="programlisting"><a class="link" href="VipsForeign.html#VipsForeignFlags" title="enum VipsForeignFlags"><span class="returnvalue">VipsForeignFlags</span></a> vips_foreign_flags (<em class="parameter"><code>const <span class="type">char</span> *loader</code></em>,
714
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
716
Return the flags for <em class="parameter"><code>filename</code></em> using <em class="parameter"><code>loader</code></em>.
717
<em class="parameter"><code>loader</code></em> is something like "tiffload" or "VipsForeignLoadTiff".
719
<div class="variablelist"><table border="0" class="variablelist">
721
<col align="left" valign="top">
726
<td><p><span class="term"><em class="parameter"><code>loader</code></em> :</span></p></td>
727
<td>name of loader to use for test</td>
730
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
731
<td>file to test</td>
734
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
735
<td>the flags for <em class="parameter"><code>filename</code></em>.</td>
741
<div class="refsect2">
742
<a name="vips-foreign-is-a"></a><h3>vips_foreign_is_a ()</h3>
743
<pre class="programlisting"><span class="returnvalue">gboolean</span> vips_foreign_is_a (<em class="parameter"><code>const <span class="type">char</span> *loader</code></em>,
744
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
746
Return <code class="literal">TRUE</code> if <em class="parameter"><code>filename</code></em> can be loaded by <em class="parameter"><code>loader</code></em>. <em class="parameter"><code>loader</code></em> is something
747
like "tiffload" or "VipsForeignLoadTiff".
749
<div class="variablelist"><table border="0" class="variablelist">
751
<col align="left" valign="top">
756
<td><p><span class="term"><em class="parameter"><code>loader</code></em> :</span></p></td>
757
<td>name of loader to use for test</td>
760
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
761
<td>file to test</td>
764
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
766
<code class="literal">TRUE</code> if <em class="parameter"><code>filename</code></em> can be loaded by <em class="parameter"><code>loader</code></em>.</td>
772
<div class="refsect2">
773
<a name="VipsSaveable"></a><h3>enum VipsSaveable</h3>
774
<pre class="programlisting">typedef enum {
778
VIPS_SAVEABLE_RGB_CMYK,
784
See also: <a class="link" href="VipsForeign.html#VipsForeignSave"><span class="type">VipsForeignSave</span></a>.
786
<div class="variablelist"><table border="0" class="variablelist">
788
<col align="left" valign="top">
793
<td><p><a name="VIPS-SAVEABLE-MONO:CAPS"></a><span class="term"><code class="literal">VIPS_SAVEABLE_MONO</code></span></p></td>
798
<td><p><a name="VIPS-SAVEABLE-RGB:CAPS"></a><span class="term"><code class="literal">VIPS_SAVEABLE_RGB</code></span></p></td>
799
<td>1 or 3 bands (eg. PPM)
803
<td><p><a name="VIPS-SAVEABLE-RGBA:CAPS"></a><span class="term"><code class="literal">VIPS_SAVEABLE_RGBA</code></span></p></td>
804
<td>1, 2, 3 or 4 bands (eg. PNG)
808
<td><p><a name="VIPS-SAVEABLE-RGB-CMYK:CAPS"></a><span class="term"><code class="literal">VIPS_SAVEABLE_RGB_CMYK</code></span></p></td>
809
<td>1, 3 or 4 bands (eg. JPEG)
813
<td><p><a name="VIPS-SAVEABLE-ANY:CAPS"></a><span class="term"><code class="literal">VIPS_SAVEABLE_ANY</code></span></p></td>
814
<td>any number of bands (eg. TIFF)
818
<td><p><a name="VIPS-SAVEABLE-LAST:CAPS"></a><span class="term"><code class="literal">VIPS_SAVEABLE_LAST</code></span></p></td>
826
<div class="refsect2">
827
<a name="VipsForeignSave-struct"></a><h3>VipsForeignSave</h3>
828
<pre class="programlisting">typedef struct {
829
/* The image we are to save, as supplied by our caller.
833
/* @in converted to a saveable format (eg. 8-bit RGB) according to the
834
* instructions you give in the class fields below.
836
* This is the image you should actually write to the output.
845
<div class="refsect2">
846
<a name="VipsForeignSaveClass"></a><h3>VipsForeignSaveClass</h3>
847
<pre class="programlisting">typedef struct {
848
VipsForeignClass parent_class;
851
/* How this format treats bands.
853
* @saveable describes the bands that your saver can handle. For
854
* example, PPM images can have 1 or 3 bands (mono or RGB), so it
855
* uses #VIPS_SAVEABLE_RGB.
857
VipsSaveable saveable;
859
/* How this format treats band formats.
861
* @format_table describes the band formats that your saver can
862
* handle. For each of the 10 #VipsBandFormat values, the array
863
* should give the format your saver will accept.
865
VipsBandFormat *format_table;
867
/* The set of coding types this format can save. For example, jpeg can
868
* only save NONE, so has NONE TRUE and RAD and LABQ FALSE.
870
* Default NONE TRUE, RAD and LABQ FALSE.
872
gboolean coding[VIPS_CODING_LAST];
873
} VipsForeignSaveClass;
876
Call your saver in the class' <em class="parameter"><code><code class="function">build()</code></code></em> method after chaining up. The
877
prepared image should be ready for you to save in <em class="parameter"><code>ready</code></em>.
880
As a complete example, here's the code for the CSV saver, minus the calls
881
to the actual save routines.
885
<div class="informalexample"><pre class="programlisting">
886
typedef struct _VipsForeignSaveCsv {
887
VipsForeignSave parent_object;
890
const char *separator;
891
} VipsForeignSaveCsv;
893
typedef VipsForeignSaveClass VipsForeignSaveCsvClass;
895
G_DEFINE_TYPE( VipsForeignSaveCsv, vips_foreign_save_csv,
896
VIPS_TYPE_FOREIGN_SAVE );
899
vips_foreign_save_csv_build( VipsObject *object )
901
VipsForeignSave *save = (VipsForeignSave *) object;
902
VipsForeignSaveCsv *csv = (VipsForeignSaveCsv *) object;
904
if( VIPS_OBJECT_CLASS( vips_foreign_save_csv_parent_class )->
908
if( vips__csv_write( save->ready, csv->filename, csv->separator ) )
915
vips_foreign_save_csv_class_init( VipsForeignSaveCsvClass *class )
917
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
918
VipsObjectClass *object_class = (VipsObjectClass *) class;
919
VipsForeignClass *foreign_class = (VipsForeignClass *) class;
920
VipsForeignSaveClass *save_class = (VipsForeignSaveClass *) class;
922
gobject_class->set_property = vips_object_set_property;
923
gobject_class->get_property = vips_object_get_property;
925
object_class->nickname = "csvsave";
926
object_class->description = _( "save image to csv file" );
927
object_class->build = vips_foreign_save_csv_build;
929
foreign_class->suffs = vips__foreign_csv_suffs;
931
save_class->saveable = VIPS_SAVEABLE_MONO;
932
// no need to define ->format_table, we don't want the input
935
VIPS_ARG_STRING( class, "filename", 1,
937
_( "Filename to save to" ),
938
VIPS_ARGUMENT_REQUIRED_INPUT,
939
G_STRUCT_OFFSET( VipsForeignSaveCsv, filename ),
942
VIPS_ARG_STRING( class, "separator", 13,
944
_( "Separator characters" ),
945
VIPS_ARGUMENT_OPTIONAL_INPUT,
946
G_STRUCT_OFFSET( VipsForeignSaveCsv, separator ),
951
vips_foreign_save_csv_init( VipsForeignSaveCsv *csv )
953
csv->separator = g_strdup( "\t" );
960
<div class="refsect2">
961
<a name="vips-foreign-find-save"></a><h3>vips_foreign_find_save ()</h3>
962
<pre class="programlisting">const <span class="returnvalue">char</span> * vips_foreign_find_save (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
964
Searches for an operation you could use to write to <em class="parameter"><code>filename</code></em>.
967
<em class="parameter"><code>filename</code></em> may not contain embedded options. See
968
<a class="link" href="VipsForeign.html#vips-foreign-find-save-options" title="vips_foreign_find_save_options ()"><code class="function">vips_foreign_find_save_options()</code></a> if your filename may have options in.
971
See also: <code class="function">vips_foreign_write()</code>.
973
<div class="variablelist"><table border="0" class="variablelist">
975
<col align="left" valign="top">
980
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
981
<td>name to find a saver for</td>
984
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
985
<td>the name of an operation on success, <code class="literal">NULL</code> on error</td>
991
<div class="refsect2">
992
<a name="vips-foreign-find-save-options"></a><h3>vips_foreign_find_save_options ()</h3>
993
<pre class="programlisting">const <span class="returnvalue">char</span> * vips_foreign_find_save_options (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
995
Searches for an operation you could use to write to <em class="parameter"><code>filename</code></em>.
998
<em class="parameter"><code>filename</code></em> may contain embedded options. See
999
<a class="link" href="VipsForeign.html#vips-foreign-find-save" title="vips_foreign_find_save ()"><code class="function">vips_foreign_find_save()</code></a> if your filename does not options in.
1002
See also: <code class="function">vips_foreign_write()</code>.
1004
<div class="variablelist"><table border="0" class="variablelist">
1006
<col align="left" valign="top">
1011
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1012
<td>name to find a saver for</td>
1015
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1016
<td>0 on success, -1 on error</td>
1022
<div class="refsect2">
1023
<a name="vips-foreign-load"></a><h3>vips_foreign_load ()</h3>
1024
<pre class="programlisting"><span class="returnvalue">int</span> vips_foreign_load (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1025
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
1026
<em class="parameter"><code>...</code></em>);</pre>
1028
Loads <em class="parameter"><code>filename</code></em> into <em class="parameter"><code>out</code></em> using the loader recommended by
1029
<a class="link" href="VipsForeign.html#vips-foreign-find-load" title="vips_foreign_find_load ()"><code class="function">vips_foreign_find_load()</code></a>.
1032
See also: <a class="link" href="VipsForeign.html#vips-foreign-save" title="vips_foreign_save ()"><code class="function">vips_foreign_save()</code></a>, <a class="link" href="VipsForeign.html#vips-foreign-load-options" title="vips_foreign_load_options ()"><code class="function">vips_foreign_load_options()</code></a>.
1034
<div class="variablelist"><table border="0" class="variablelist">
1036
<col align="left" valign="top">
1041
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1042
<td>file to load</td>
1045
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1046
<td>output image</td>
1049
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1051
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1054
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1055
<td>0 on success, -1 on error</td>
1061
<div class="refsect2">
1062
<a name="vips-foreign-save"></a><h3>vips_foreign_save ()</h3>
1063
<pre class="programlisting"><span class="returnvalue">int</span> vips_foreign_save (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1064
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1065
<em class="parameter"><code>...</code></em>);</pre>
1067
Saves <em class="parameter"><code>in</code></em> to <em class="parameter"><code>filename</code></em> using the saver recommended by
1068
<a class="link" href="VipsForeign.html#vips-foreign-find-save" title="vips_foreign_find_save ()"><code class="function">vips_foreign_find_save()</code></a>. Options are not in <em class="parameter"><code>filename</code></em> but must be given
1069
as a NULL-terminated list of name-value pairs.
1072
See also: <a class="link" href="VipsForeign.html#vips-foreign-load" title="vips_foreign_load ()"><code class="function">vips_foreign_load()</code></a>.
1074
<div class="variablelist"><table border="0" class="variablelist">
1076
<col align="left" valign="top">
1081
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1082
<td>image to write</td>
1085
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1086
<td>file to write to</td>
1089
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1091
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1094
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1095
<td>0 on success, -1 on error</td>
1101
<div class="refsect2">
1102
<a name="vips-foreign-load-options"></a><h3>vips_foreign_load_options ()</h3>
1103
<pre class="programlisting"><span class="returnvalue">int</span> vips_foreign_load_options (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1104
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
1105
<em class="parameter"><code>...</code></em>);</pre>
1107
Loads <em class="parameter"><code>filename</code></em> into <em class="parameter"><code>out</code></em> using the loader recommended by
1108
<a class="link" href="VipsForeign.html#vips-foreign-find-load" title="vips_foreign_find_load ()"><code class="function">vips_foreign_find_load()</code></a>.
1111
Arguments to the loader may be embedded in the filename using the usual
1112
syntax. They may also be given as a set of NULL-terminated optional
1116
See also: <a class="link" href="VipsForeign.html#vips-foreign-load" title="vips_foreign_load ()"><code class="function">vips_foreign_load()</code></a>.
1118
<div class="variablelist"><table border="0" class="variablelist">
1120
<col align="left" valign="top">
1125
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1126
<td>file to load</td>
1129
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1130
<td>output image</td>
1133
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1135
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1138
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1139
<td>0 on success, -1 on error</td>
1145
<div class="refsect2">
1146
<a name="vips-foreign-save-options"></a><h3>vips_foreign_save_options ()</h3>
1147
<pre class="programlisting"><span class="returnvalue">int</span> vips_foreign_save_options (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1148
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1149
<em class="parameter"><code>...</code></em>);</pre>
1151
Saves <em class="parameter"><code>in</code></em> to <em class="parameter"><code>filename</code></em> using the saver recommended by
1152
<a class="link" href="VipsForeign.html#vips-foreign-find-save" title="vips_foreign_find_save ()"><code class="function">vips_foreign_find_save()</code></a>.
1155
Arguments to the saver may be embedded in the filename using the usual
1156
syntax. They may also be given as a set of NULL-terminated optional
1160
See also: <a class="link" href="VipsForeign.html#vips-foreign-save" title="vips_foreign_save ()"><code class="function">vips_foreign_save()</code></a>.
1162
<div class="variablelist"><table border="0" class="variablelist">
1164
<col align="left" valign="top">
1169
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1170
<td>image to write</td>
1173
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1174
<td>file to write to</td>
1177
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1179
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1182
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1183
<td>0 on success, -1 on error</td>
1189
<div class="refsect2">
1190
<a name="vips-openslideload"></a><h3>vips_openslideload ()</h3>
1191
<pre class="programlisting"><span class="returnvalue">int</span> vips_openslideload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1192
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
1193
<em class="parameter"><code>...</code></em>);</pre>
1198
<em class="parameter"><code>layer</code></em>: load this layer
1199
<em class="parameter"><code>associated</code></em>: load this associated image
1202
Read a virtual slide supported by the OpenSlide library into a VIPS image.
1203
OpenSlide supports images in Aperio, Hamamatsu VMS, Hamamatsu VMU, MIRAX,
1204
and Trestle formats.
1207
To facilitate zooming, virtual slide formats include multiple scaled-down
1208
versions of the high-resolution image. These are typically called
1209
"levels", though OpenSlide and <code class="function">im_openslide2vips()</code> call them "layers".
1210
By default, <a class="link" href="VipsForeign.html#vips-openslideload" title="vips_openslideload ()"><code class="function">vips_openslideload()</code></a> reads the highest-resolution layer
1211
(layer 0). Set <em class="parameter"><code>layer</code></em> to the layer number you want.
1214
In addition to the slide image itself, virtual slide formats sometimes
1215
include additional images, such as a scan of the slide's barcode.
1216
OpenSlide calls these "associated images". To read an associated image,
1217
set <em class="parameter"><code>associated</code></em> to the image's name.
1218
A slide's associated images are listed in the
1219
"slide-associated-images" metadata item.
1222
The output of this operator is in pre-multipled ARGB format. Use
1223
<code class="function">im_argb2rgba()</code> to decode to png-style RGBA.
1226
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
1228
<div class="variablelist"><table border="0" class="variablelist">
1230
<col align="left" valign="top">
1235
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1236
<td>file to load</td>
1239
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1240
<td>decompressed image</td>
1243
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1245
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1248
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1249
<td>0 on success, -1 on error.</td>
1255
<div class="refsect2">
1256
<a name="vips-jpegload"></a><h3>vips_jpegload ()</h3>
1257
<pre class="programlisting"><span class="returnvalue">int</span> vips_jpegload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1258
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
1259
<em class="parameter"><code>...</code></em>);</pre>
1264
<em class="parameter"><code>shrink</code></em>: shrink by this much on load
1265
<em class="parameter"><code>fail</code></em>: fail on warnings
1268
Read a JPEG file into a VIPS image. It can read most 8-bit JPEG images,
1269
including CMYK and YCbCr.
1272
<em class="parameter"><code>shrink</code></em> means shrink by this integer factor during load. Possible values
1273
are 1, 2, 4 and 8. Shrinking during read is very much faster than
1274
decompressing the whole image and then shrinking later.
1277
Setting <em class="parameter"><code>fail</code></em> to true makes the JPEG reader fail on any warnings.
1278
This can be useful for detecting truncated files, for example. Normally
1279
reading these produces a warning, but no fatal error.
1286
<div class="informalexample"><pre class="programlisting">
1287
vips_jpegload( "fred.jpg", &out,
1295
Any embedded ICC profiles are ignored: you always just get the RGB from
1296
the file. Instead, the embedded profile will be attached to the image as
1297
<em class="parameter"><code>VIPS_META_ICC_NAME</code></em> ("icc-profile-data"). You need to use something like
1298
<a class="link" href="libvips-colour.html#vips-icc-import" title="vips_icc_import ()"><code class="function">vips_icc_import()</code></a> to get CIE values from the file.
1301
EXIF metadata is attached as <em class="parameter"><code>VIPS_META_EXIF_NAME</code></em> ("exif-data"), IPCT as
1302
<em class="parameter"><code>VIPS_META_IPCT_NAME</code></em> ("ipct-data"), and XMP as VIPS_META_XMP_NAME
1306
The int metadata item "jpeg-multiscan" is set to the result of
1307
<code class="function">jpeg_has_multiple_scans()</code>. Interlaced jpeg images need a large amount of
1308
memory to load, so this field gives callers a chance to handle these
1312
The EXIF thumbnail, if present, is attached to the image as
1313
"jpeg-thumbnail-data". See <a class="link" href="libvips-header.html#vips-image-get-blob" title="vips_image_get_blob ()"><code class="function">vips_image_get_blob()</code></a>.
1316
This function only reads the image header and does not decompress any pixel
1317
data. Decompression only occurs when pixels are accessed by some other
1321
See also: <a class="link" href="VipsForeign.html#vips-jpegload-buffer" title="vips_jpegload_buffer ()"><code class="function">vips_jpegload_buffer()</code></a>, <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
1323
<div class="variablelist"><table border="0" class="variablelist">
1325
<col align="left" valign="top">
1330
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1331
<td>file to load</td>
1334
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1335
<td>decompressed image</td>
1338
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1340
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1343
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1344
<td>0 on success, -1 on error.</td>
1350
<div class="refsect2">
1351
<a name="vips-jpegload-buffer"></a><h3>vips_jpegload_buffer ()</h3>
1352
<pre class="programlisting"><span class="returnvalue">int</span> vips_jpegload_buffer (<em class="parameter"><code><span class="type">void</span> *buf</code></em>,
1353
<em class="parameter"><code><span class="type">size_t</span> len</code></em>,
1354
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
1355
<em class="parameter"><code>...</code></em>);</pre>
1357
Read a JPEG-formatted memory block into a VIPS image. It can read most
1358
8-bit JPEG images, including CMYK and YCbCr.
1361
This function is handy for processing JPEG image thumbnails.
1364
Caution: on return only the header will have been read, the pixel data is
1365
not decompressed until the first pixel is read. Therefore you must not free
1366
<em class="parameter"><code>buf</code></em> until you have read pixel data from <em class="parameter"><code>out</code></em>.
1369
See also: <a class="link" href="VipsForeign.html#vips-jpegload" title="vips_jpegload ()"><code class="function">vips_jpegload()</code></a>.
1371
<div class="variablelist"><table border="0" class="variablelist">
1373
<col align="left" valign="top">
1378
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
1379
<td>memory area to load</td>
1382
<td><p><span class="term"><em class="parameter"><code>len</code></em> :</span></p></td>
1383
<td>size of memory area</td>
1386
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1387
<td>image to write</td>
1390
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1392
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1395
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1396
<td>0 on success, -1 on error.</td>
1402
<div class="refsect2">
1403
<a name="vips-jpegsave"></a><h3>vips_jpegsave ()</h3>
1404
<pre class="programlisting"><span class="returnvalue">int</span> vips_jpegsave (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1405
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1406
<em class="parameter"><code>...</code></em>);</pre>
1411
<em class="parameter"><code>Q</code></em>: quality factor
1412
<em class="parameter"><code>profile</code></em>: attach this ICC profile
1413
<em class="parameter"><code>optimize_coding</code></em>: compute optimal Huffman coding tables
1414
<em class="parameter"><code>interlace</code></em>: write an interlaced (progressive) jpeg
1415
<em class="parameter"><code>strip</code></em>: remove all metadata from image
1416
<em class="parameter"><code>no</code></em>-subsample: disable chroma subsampling
1419
Write a VIPS image to a file as JPEG.
1422
Use <em class="parameter"><code>Q</code></em> to set the JPEG compression factor. Default 75.
1425
Use <em class="parameter"><code>profile</code></em> to give the filename of a profile to be embedded in the JPEG.
1426
This does not affect the pixels which are written, just the way
1427
they are tagged. You can use the special string "none" to mean
1428
"don't attach a profile".
1431
If no profile is specified and the VIPS header
1432
contains an ICC profile named VIPS_META_ICC_NAME ("icc-profile-data"), the
1433
profile from the VIPS header will be attached.
1436
The image is automatically converted to RGB, Monochrome or CMYK before
1440
EXIF data is constructed from <em class="parameter"><code>VIPS_META_EXIF_NAME</code></em> ("exif-data"), then
1441
modified with any other related tags on the image before being written to
1445
IPCT as <em class="parameter"><code>VIPS_META_IPCT_NAME</code></em> ("ipct-data") and XMP as VIPS_META_XMP_NAME
1446
("xmp-data") are coded and attached.
1449
If <em class="parameter"><code>optimize_coding</code></em> is set, the Huffman tables are optimised. This is
1450
sllightly slower and produces slightly smaller files.
1453
If <em class="parameter"><code>interlace</code></em> is set, the jpeg files will be interlaced (progressive jpeg,
1454
in jpg parlance). These files may be better for display over a slow network
1455
conection, but need much more memory to encode and decode.
1458
If <em class="parameter"><code>strip</code></em> is set, no EXIF data, IPCT data, ICC profile or XMP metadata is
1459
written into the output file.
1462
If <em class="parameter"><code>no</code></em>-subsample is set, chrominance subsampling is disabled. This will
1463
improve quality at the cost of larger file size. Useful for high Q factors.
1466
See also: <a class="link" href="VipsForeign.html#vips-jpegsave-buffer" title="vips_jpegsave_buffer ()"><code class="function">vips_jpegsave_buffer()</code></a>, <code class="function">vips_image_write_file()</code>.
1468
<div class="variablelist"><table border="0" class="variablelist">
1470
<col align="left" valign="top">
1475
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1476
<td>image to save</td>
1479
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1480
<td>file to write to</td>
1483
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1485
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1488
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1489
<td>0 on success, -1 on error.</td>
1495
<div class="refsect2">
1496
<a name="vips-jpegsave-buffer"></a><h3>vips_jpegsave_buffer ()</h3>
1497
<pre class="programlisting"><span class="returnvalue">int</span> vips_jpegsave_buffer (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1498
<em class="parameter"><code><span class="type">void</span> **buf</code></em>,
1499
<em class="parameter"><code><span class="type">size_t</span> *len</code></em>,
1500
<em class="parameter"><code>...</code></em>);</pre>
1505
<em class="parameter"><code>Q</code></em>: JPEG quality factor
1506
<em class="parameter"><code>profile</code></em>: attach this ICC profile
1507
<em class="parameter"><code>optimize_coding</code></em>: compute optimal Huffman coding tables
1508
<em class="parameter"><code>interlace</code></em>: write an interlaced (progressive) jpeg
1509
<em class="parameter"><code>strip</code></em>: remove all metadata from image
1510
<em class="parameter"><code>no</code></em>-subsample: disable chroma subsampling
1513
As <a class="link" href="VipsForeign.html#vips-jpegsave" title="vips_jpegsave ()"><code class="function">vips_jpegsave()</code></a>, but save to a memory buffer.
1516
The address of the buffer is returned in <em class="parameter"><code>obuf</code></em>, the length of the buffer in
1517
<em class="parameter"><code>olen</code></em>. You are responsible for freeing the buffer with <code class="function">g_free()</code> when you
1521
See also: <a class="link" href="VipsForeign.html#vips-jpegsave" title="vips_jpegsave ()"><code class="function">vips_jpegsave()</code></a>, <a class="link" href="VipsImage.html#vips-image-write-to-file" title="vips_image_write_to_file ()"><code class="function">vips_image_write_to_file()</code></a>.
1523
<div class="variablelist"><table border="0" class="variablelist">
1525
<col align="left" valign="top">
1530
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1531
<td>image to save</td>
1534
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
1535
<td>return output buffer here</td>
1538
<td><p><span class="term"><em class="parameter"><code>len</code></em> :</span></p></td>
1539
<td>return output length here</td>
1542
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1544
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1547
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1548
<td>0 on success, -1 on error.</td>
1554
<div class="refsect2">
1555
<a name="vips-jpegsave-mime"></a><h3>vips_jpegsave_mime ()</h3>
1556
<pre class="programlisting"><span class="returnvalue">int</span> vips_jpegsave_mime (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1557
<em class="parameter"><code>...</code></em>);</pre>
1562
<em class="parameter"><code>Q</code></em>: JPEG quality factor
1563
<em class="parameter"><code>profile</code></em>: attach this ICC profile
1564
<em class="parameter"><code>optimize_coding</code></em>: compute optimal Huffman coding tables
1565
<em class="parameter"><code>strip</code></em>: remove all metadata from image
1566
<em class="parameter"><code>no</code></em>-subsample: disable chroma subsampling
1569
As <a class="link" href="VipsForeign.html#vips-jpegsave" title="vips_jpegsave ()"><code class="function">vips_jpegsave()</code></a>, but save as a mime jpeg on stdout.
1572
See also: <a class="link" href="VipsForeign.html#vips-jpegsave" title="vips_jpegsave ()"><code class="function">vips_jpegsave()</code></a>, <a class="link" href="VipsImage.html#vips-image-write-to-file" title="vips_image_write_to_file ()"><code class="function">vips_image_write_to_file()</code></a>.
1574
<div class="variablelist"><table border="0" class="variablelist">
1576
<col align="left" valign="top">
1581
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1582
<td>image to save</td>
1585
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1587
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1590
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1591
<td>0 on success, -1 on error.</td>
1597
<div class="refsect2">
1598
<a name="vips-webpload"></a><h3>vips_webpload ()</h3>
1599
<pre class="programlisting"><span class="returnvalue">int</span> vips_webpload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1600
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
1601
<em class="parameter"><code>...</code></em>);</pre>
1606
Read a webp file into a VIPS image.
1611
<div class="variablelist"><table border="0" class="variablelist">
1613
<col align="left" valign="top">
1618
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1619
<td>file to load</td>
1622
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1623
<td>decompressed image</td>
1626
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1628
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1631
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1632
<td>0 on success, -1 on error.</td>
1638
<div class="refsect2">
1639
<a name="vips-webpload-buffer"></a><h3>vips_webpload_buffer ()</h3>
1640
<pre class="programlisting"><span class="returnvalue">int</span> vips_webpload_buffer (<em class="parameter"><code><span class="type">void</span> *buf</code></em>,
1641
<em class="parameter"><code><span class="type">size_t</span> len</code></em>,
1642
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
1643
<em class="parameter"><code>...</code></em>);</pre>
1647
<div class="variablelist"><table border="0" class="variablelist">
1649
<col align="left" valign="top">
1654
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
1655
<td>memory area to load</td>
1658
<td><p><span class="term"><em class="parameter"><code>len</code></em> :</span></p></td>
1659
<td>size of memory area</td>
1662
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1663
<td>image to write</td>
1666
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1668
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1671
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1672
<td>0 on success, -1 on error.</td>
1678
<div class="refsect2">
1679
<a name="vips-webpsave"></a><h3>vips_webpsave ()</h3>
1680
<pre class="programlisting"><span class="returnvalue">int</span> vips_webpsave (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1681
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1682
<em class="parameter"><code>...</code></em>);</pre>
1687
<em class="parameter"><code>Q</code></em>: quality factor
1692
<div class="variablelist"><table border="0" class="variablelist">
1694
<col align="left" valign="top">
1699
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1700
<td>image to save</td>
1703
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1704
<td>file to write to</td>
1707
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1709
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1712
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1713
<td>0 on success, -1 on error.</td>
1719
<div class="refsect2">
1720
<a name="vips-webpsave-buffer"></a><h3>vips_webpsave_buffer ()</h3>
1721
<pre class="programlisting"><span class="returnvalue">int</span> vips_webpsave_buffer (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1722
<em class="parameter"><code><span class="type">void</span> **buf</code></em>,
1723
<em class="parameter"><code><span class="type">size_t</span> *len</code></em>,
1724
<em class="parameter"><code>...</code></em>);</pre>
1729
<em class="parameter"><code>Q</code></em>: JPEG quality factor
1734
<div class="variablelist"><table border="0" class="variablelist">
1736
<col align="left" valign="top">
1741
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1742
<td>image to save</td>
1745
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
1746
<td>return output buffer here</td>
1749
<td><p><span class="term"><em class="parameter"><code>len</code></em> :</span></p></td>
1750
<td>return output length here</td>
1753
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1755
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1758
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1759
<td>0 on success, -1 on error.</td>
1765
<div class="refsect2">
1766
<a name="vips-webpsave-mime"></a><h3>vips_webpsave_mime ()</h3>
1767
<pre class="programlisting"><span class="returnvalue">int</span> vips_webpsave_mime (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
1768
<em class="parameter"><code>...</code></em>);</pre>
1773
<em class="parameter"><code>Q</code></em>: quality factor
1778
<div class="variablelist"><table border="0" class="variablelist">
1780
<col align="left" valign="top">
1785
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
1786
<td>image to save</td>
1789
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1791
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1794
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1795
<td>0 on success, -1 on error.</td>
1801
<div class="refsect2">
1802
<a name="VipsForeignTiffCompression"></a><h3>enum VipsForeignTiffCompression</h3>
1803
<pre class="programlisting">typedef enum {
1804
VIPS_FOREIGN_TIFF_COMPRESSION_NONE,
1805
VIPS_FOREIGN_TIFF_COMPRESSION_JPEG,
1806
VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE,
1807
VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS,
1808
VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4,
1809
VIPS_FOREIGN_TIFF_COMPRESSION_LZW,
1810
VIPS_FOREIGN_TIFF_COMPRESSION_LAST
1811
} VipsForeignTiffCompression;
1814
The compression types supported by the tiff writer.
1817
Use <em class="parameter"><code>Q</code></em> to set the jpeg compression level, default 75.
1820
Use <em class="parameter"><code>prediction</code></em> to set the lzw or deflate prediction, default none.
1822
<div class="variablelist"><table border="0" class="variablelist">
1824
<col align="left" valign="top">
1829
<td><p><a name="VIPS-FOREIGN-TIFF-COMPRESSION-NONE:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_COMPRESSION_NONE</code></span></p></td>
1834
<td><p><a name="VIPS-FOREIGN-TIFF-COMPRESSION-JPEG:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_COMPRESSION_JPEG</code></span></p></td>
1835
<td>jpeg compression
1839
<td><p><a name="VIPS-FOREIGN-TIFF-COMPRESSION-DEFLATE:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE</code></span></p></td>
1840
<td>deflate (zip) compression
1844
<td><p><a name="VIPS-FOREIGN-TIFF-COMPRESSION-PACKBITS:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS</code></span></p></td>
1845
<td>packbits compression
1849
<td><p><a name="VIPS-FOREIGN-TIFF-COMPRESSION-CCITTFAX4:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4</code></span></p></td>
1850
<td>fax4 compression
1854
<td><p><a name="VIPS-FOREIGN-TIFF-COMPRESSION-LZW:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_COMPRESSION_LZW</code></span></p></td>
1859
<td><p><a name="VIPS-FOREIGN-TIFF-COMPRESSION-LAST:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_COMPRESSION_LAST</code></span></p></td>
1867
<div class="refsect2">
1868
<a name="VipsForeignTiffPredictor"></a><h3>enum VipsForeignTiffPredictor</h3>
1869
<pre class="programlisting">typedef enum {
1870
VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1,
1871
VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2,
1872
VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3,
1873
VIPS_FOREIGN_TIFF_PREDICTOR_LAST
1874
} VipsForeignTiffPredictor;
1877
The predictor can help deflate and lzw compression. The values are fixed by
1880
<div class="variablelist"><table border="0" class="variablelist">
1882
<col align="left" valign="top">
1887
<td><p><a name="VIPS-FOREIGN-TIFF-PREDICTOR-NONE:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_PREDICTOR_NONE</code></span></p></td>
1892
<td><p><a name="VIPS-FOREIGN-TIFF-PREDICTOR-HORIZONTAL:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL</code></span></p></td>
1893
<td>horizontal differencing
1897
<td><p><a name="VIPS-FOREIGN-TIFF-PREDICTOR-FLOAT:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT</code></span></p></td>
1902
<td><p><a name="VIPS-FOREIGN-TIFF-PREDICTOR-LAST:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_PREDICTOR_LAST</code></span></p></td>
1910
<div class="refsect2">
1911
<a name="VipsForeignTiffResunit"></a><h3>enum VipsForeignTiffResunit</h3>
1912
<pre class="programlisting">typedef enum {
1913
VIPS_FOREIGN_TIFF_RESUNIT_CM,
1914
VIPS_FOREIGN_TIFF_RESUNIT_INCH,
1915
VIPS_FOREIGN_TIFF_RESUNIT_LAST
1916
} VipsForeignTiffResunit;
1919
Use inches or centimeters as the resolution unit for a tiff file.
1921
<div class="variablelist"><table border="0" class="variablelist">
1923
<col align="left" valign="top">
1928
<td><p><a name="VIPS-FOREIGN-TIFF-RESUNIT-CM:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_RESUNIT_CM</code></span></p></td>
1933
<td><p><a name="VIPS-FOREIGN-TIFF-RESUNIT-INCH:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_RESUNIT_INCH</code></span></p></td>
1938
<td><p><a name="VIPS-FOREIGN-TIFF-RESUNIT-LAST:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_TIFF_RESUNIT_LAST</code></span></p></td>
1946
<div class="refsect2">
1947
<a name="vips-tiffload"></a><h3>vips_tiffload ()</h3>
1948
<pre class="programlisting"><span class="returnvalue">int</span> vips_tiffload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
1949
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
1950
<em class="parameter"><code>...</code></em>);</pre>
1955
<em class="parameter"><code>page</code></em>: load this page
1958
Read a TIFF file into a VIPS image. It is a full baseline TIFF 6 reader,
1959
with extensions for tiled images, multipage images, LAB colour space,
1960
pyramidal images and JPEG compression. including CMYK and YCbCr.
1963
<em class="parameter"><code>page</code></em> means load this page from the file. By default the first page (page
1967
Any ICC profile is read and attached to the VIPS image.
1970
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
1972
<div class="variablelist"><table border="0" class="variablelist">
1974
<col align="left" valign="top">
1979
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
1980
<td>file to load</td>
1983
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
1984
<td>decompressed image</td>
1987
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1989
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
1992
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1993
<td>0 on success, -1 on error.</td>
1999
<div class="refsect2">
2000
<a name="vips-tiffsave"></a><h3>vips_tiffsave ()</h3>
2001
<pre class="programlisting"><span class="returnvalue">int</span> vips_tiffsave (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
2002
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2003
<em class="parameter"><code>...</code></em>);</pre>
2008
<em class="parameter"><code>compression</code></em>; use this compression scheme
2009
<em class="parameter"><code>Q</code></em>: quality factor
2010
<em class="parameter"><code>predictor</code></em>; compress with this prediction
2011
<em class="parameter"><code>profile</code></em>: attach this ICC profile
2012
<em class="parameter"><code>tile</code></em>; set <code class="literal">TRUE</code> to write a tiled tiff
2013
<em class="parameter"><code>tile_width</code></em>; set tile size
2014
<em class="parameter"><code>tile_height</code></em>; set tile size
2015
<em class="parameter"><code>pyramid</code></em>; set <code class="literal">TRUE</code> to write an image pyramid
2016
<em class="parameter"><code>squash</code></em>; squash 8-bit images down to 1 bit
2017
<em class="parameter"><code>resunit</code></em>; convert resolution to pixels per inch or cm during write
2018
<em class="parameter"><code>xres</code></em>; horizontal resolution in pixels/mm
2019
<em class="parameter"><code>yres</code></em>; vertical resolution in pixels/mm
2020
<em class="parameter"><code>bigtiff</code></em>; write a BigTiff file
2023
Write a VIPS image to a file as TIFF.
2026
Use <em class="parameter"><code>compression</code></em> to set the tiff compression. Currently jpeg, packbits,
2027
fax4, lzw, none and deflate are supported. The default is no compression.
2028
JPEG compression is a good lossy compressor for photographs, packbits is
2029
good for 1-bit images, and deflate is the best lossless compression TIFF
2030
can do. LZW has patent problems and is no longer recommended.
2033
Use <em class="parameter"><code>Q</code></em> to set the JPEG compression factor. Default 75.
2036
Use <em class="parameter"><code>predictor</code></em> to set the predictor for lzw and deflate compression.
2039
Predictor is not set by default. There are three predictor values recognised
2040
at the moment (2007, July): 1 is no prediction, 2 is a horizontal
2041
differencing and 3 is a floating point predictor. Refer to the libtiff
2042
specifications for further discussion of various predictors. In short,
2043
predictor helps to better compress image, especially in case of digital
2044
photos or scanned images and bit depths > 8. Try it to find whether it
2045
works for your images.
2048
Use <em class="parameter"><code>profile</code></em> to give the filename of a profile to be embedded in the TIFF.
2049
This does not affect the pixels which are written, just the way
2050
they are tagged. You can use the special string "none" to mean
2051
"don't attach a profile".
2054
If no profile is specified and the VIPS header
2055
contains an ICC profile named VIPS_META_ICC_NAME ("icc-profile-data"), the
2056
profile from the VIPS header will be attached.
2059
Set <em class="parameter"><code>tile</code></em> to TRUE to write a tiled tiff. By default tiff are written in
2060
strips. Use <em class="parameter"><code>tile_width</code></em> and <em class="parameter"><code>tile_height</code></em> to set the tile size. The defaiult
2064
Set <em class="parameter"><code>pyramid</code></em> to write the image as a set of images, one per page, of
2068
Set <em class="parameter"><code>squash</code></em> to make 8-bit uchar images write as 1-bit TIFFs with zero
2069
pixels written as 0 and non-zero as 1.
2072
Use <em class="parameter"><code>resunit</code></em> to override the default resolution unit.
2074
resolution unit is taken from the header field "resolution-unit"
2075
(<a class="link" href="libvips-header.html#VIPS-META-RESOLUTION-UNIT:CAPS" title="VIPS_META_RESOLUTION_UNIT"><span class="type">VIPS_META_RESOLUTION_UNIT</span></a> in C). If this field is not set, then
2076
VIPS defaults to cm.
2079
Use <em class="parameter"><code>xres</code></em> and <em class="parameter"><code>yres</code></em> to override the default horizontal and vertical
2080
resolutions. By default these values are taken from the VIPS image header.
2081
libvips resolution is always in pixels per millimetre.
2084
Set <em class="parameter"><code>bigtiff</code></em> to attempt to write a bigtiff.
2085
Bigtiff is a variant of the TIFF
2086
format that allows more than 4GB in a file.
2089
See also: <a class="link" href="VipsForeign.html#vips-tiffload" title="vips_tiffload ()"><code class="function">vips_tiffload()</code></a>, <code class="function">vips_image_write_file()</code>.
2091
<div class="variablelist"><table border="0" class="variablelist">
2093
<col align="left" valign="top">
2098
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
2099
<td>image to save</td>
2102
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2103
<td>file to write to</td>
2106
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2108
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2111
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2112
<td>0 on success, -1 on error.</td>
2118
<div class="refsect2">
2119
<a name="vips-openexrload"></a><h3>vips_openexrload ()</h3>
2120
<pre class="programlisting"><span class="returnvalue">int</span> vips_openexrload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2121
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
2122
<em class="parameter"><code>...</code></em>);</pre>
2124
Read a OpenEXR file into a VIPS image.
2127
The reader can handle scanline and tiled OpenEXR images. It can't handle
2128
OpenEXR colour management, image attributes, many pixel formats, anything
2132
This reader uses the rather limited OpenEXR C API. It should really be
2136
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
2138
<div class="variablelist"><table border="0" class="variablelist">
2140
<col align="left" valign="top">
2145
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2146
<td>file to load</td>
2149
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
2150
<td>decompressed image</td>
2153
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2155
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2158
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2159
<td>0 on success, -1 on error.</td>
2165
<div class="refsect2">
2166
<a name="vips-fitsload"></a><h3>vips_fitsload ()</h3>
2167
<pre class="programlisting"><span class="returnvalue">int</span> vips_fitsload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2168
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
2169
<em class="parameter"><code>...</code></em>);</pre>
2171
Read a FITS image file into a VIPS image.
2174
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
2176
<div class="variablelist"><table border="0" class="variablelist">
2178
<col align="left" valign="top">
2183
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2184
<td>file to load</td>
2187
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
2188
<td>decompressed image</td>
2191
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2193
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2196
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2197
<td>0 on success, -1 on error.</td>
2203
<div class="refsect2">
2204
<a name="vips-fitssave"></a><h3>vips_fitssave ()</h3>
2205
<pre class="programlisting"><span class="returnvalue">int</span> vips_fitssave (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
2206
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2207
<em class="parameter"><code>...</code></em>);</pre>
2209
Write a VIPS image to a file as FITS.
2212
See also: <code class="function">vips_image_write_file()</code>.
2214
<div class="variablelist"><table border="0" class="variablelist">
2216
<col align="left" valign="top">
2221
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
2222
<td>image to save</td>
2225
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2226
<td>file to write to</td>
2229
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2231
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2234
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2235
<td>0 on success, -1 on error.</td>
2241
<div class="refsect2">
2242
<a name="vips-analyzeload"></a><h3>vips_analyzeload ()</h3>
2243
<pre class="programlisting"><span class="returnvalue">int</span> vips_analyzeload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2244
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
2245
<em class="parameter"><code>...</code></em>);</pre>
2247
Load an Analyze 6.0 file. If <em class="parameter"><code>filename</code></em> is "fred.img", this will look for
2248
an image header called "fred.hdr" and pixel data in "fred.img". You can
2249
also load "fred" or "fred.hdr".
2253
loaded lazilly and byte-swapped, if necessary. The Analyze metadata is read
2257
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
2259
<div class="variablelist"><table border="0" class="variablelist">
2261
<col align="left" valign="top">
2266
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2267
<td>file to load</td>
2270
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
2271
<td>decompressed image</td>
2274
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2276
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2279
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2280
<td>0 on success, -1 on error.</td>
2286
<div class="refsect2">
2287
<a name="vips-rawload"></a><h3>vips_rawload ()</h3>
2288
<pre class="programlisting"><span class="returnvalue">int</span> vips_rawload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2289
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
2290
<em class="parameter"><code><span class="type">int</span> width</code></em>,
2291
<em class="parameter"><code><span class="type">int</span> height</code></em>,
2292
<em class="parameter"><code><span class="type">int</span> bands</code></em>,
2293
<em class="parameter"><code>...</code></em>);</pre>
2298
<em class="parameter"><code>width</code></em>: width of image in pixels
2299
<em class="parameter"><code>height</code></em>: height of image in pixels
2300
<em class="parameter"><code>bands</code></em>: number of image bands
2301
<em class="parameter"><code>offset</code></em>: offset in bytes from start of file
2304
This operation mmaps the file, setting <em class="parameter"><code>out</code></em> so that access to that
2305
image will read from the file.
2308
Use functions like <a class="link" href="libvips-conversion.html#vips-copy" title="vips_copy ()"><code class="function">vips_copy()</code></a> to set the pixel type, byte ordering
2312
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
2314
<div class="variablelist"><table border="0" class="variablelist">
2316
<col align="left" valign="top">
2321
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2322
<td>file to load</td>
2325
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
2326
<td>output image</td>
2329
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2331
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2334
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2335
<td>0 on success, -1 on error.</td>
2341
<div class="refsect2">
2342
<a name="vips-rawsave"></a><h3>vips_rawsave ()</h3>
2343
<pre class="programlisting"><span class="returnvalue">int</span> vips_rawsave (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
2344
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2345
<em class="parameter"><code>...</code></em>);</pre>
2347
Writes the pixels in <em class="parameter"><code>in</code></em> to the file <em class="parameter"><code>filename</code></em> with no header or other
2351
See also: <code class="function">vips_image_write_file()</code>.
2353
<div class="variablelist"><table border="0" class="variablelist">
2355
<col align="left" valign="top">
2360
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
2361
<td>image to save</td>
2364
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2365
<td>file to write to</td>
2368
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2370
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2373
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2374
<td>0 on success, -1 on error.</td>
2380
<div class="refsect2">
2381
<a name="vips-rawsave-fd"></a><h3>vips_rawsave_fd ()</h3>
2382
<pre class="programlisting"><span class="returnvalue">int</span> vips_rawsave_fd (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
2383
<em class="parameter"><code><span class="type">int</span> fd</code></em>,
2384
<em class="parameter"><code>...</code></em>);</pre>
2386
Writes the pixels in <em class="parameter"><code>in</code></em> to the <em class="parameter"><code>fd</code></em> with no header or other
2387
metadata. Handy for implementing other savers.
2390
See also: <a class="link" href="VipsForeign.html#vips-rawsave" title="vips_rawsave ()"><code class="function">vips_rawsave()</code></a>.
2392
<div class="variablelist"><table border="0" class="variablelist">
2394
<col align="left" valign="top">
2399
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
2400
<td>image to save</td>
2403
<td><p><span class="term"><em class="parameter"><code>fd</code></em> :</span></p></td>
2404
<td>file to write to</td>
2407
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2409
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2412
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2413
<td>0 on success, -1 on error.</td>
2419
<div class="refsect2">
2420
<a name="vips-csvload"></a><h3>vips_csvload ()</h3>
2421
<pre class="programlisting"><span class="returnvalue">int</span> vips_csvload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2422
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
2423
<em class="parameter"><code>...</code></em>);</pre>
2428
<em class="parameter"><code>skip</code></em>: skip this many lines at start of file
2429
<em class="parameter"><code>lines</code></em>: read this many lines from file
2430
<em class="parameter"><code>whitespace</code></em>: set of whitespace characters
2431
<em class="parameter"><code>separator</code></em>: set of separator characters
2434
Load a CSV (comma-separated values) file. The output image is always 1
2435
band (monochrome), <a class="link" href="VipsImage.html#VIPS-FORMAT-DOUBLE:CAPS"><span class="type">VIPS_FORMAT_DOUBLE</span></a>.
2438
Items in lines can be either floating point numbers in the C locale, or
2439
strings enclosed in double-quotes ("), or empty.
2440
You can use a backslash (\) within the quotes to escape special characters,
2441
such as quote marks.
2444
The reader is deliberately rather fussy: it will fail if there are any
2445
short lines, or if the file is too short. It will ignore lines that are
2449
<em class="parameter"><code>skip</code></em> sets the number of lines to skip at the start of the file.
2453
<em class="parameter"><code>lines</code></em> sets the number of lines to read from the file. Default -1,
2454
meaning read all lines to end of file.
2457
<em class="parameter"><code>whitespace</code></em> sets the skippable whitespace characters.
2458
Default <span class="emphasis"><em>space</em></span>.
2459
Whitespace characters are always run together.
2462
<em class="parameter"><code>separator</code></em> sets the characters that separate fields.
2463
Default ;,<span class="emphasis"><em>tab</em></span>. Separators are never run together.
2466
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
2468
<div class="variablelist"><table border="0" class="variablelist">
2470
<col align="left" valign="top">
2475
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2476
<td>file to load</td>
2479
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
2480
<td>output image</td>
2483
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2485
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2488
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2489
<td>0 on success, -1 on error.</td>
2495
<div class="refsect2">
2496
<a name="vips-csvsave"></a><h3>vips_csvsave ()</h3>
2497
<pre class="programlisting"><span class="returnvalue">int</span> vips_csvsave (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
2498
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2499
<em class="parameter"><code>...</code></em>);</pre>
2504
<em class="parameter"><code>separator</code></em>: separator string
2507
Writes the pixels in <em class="parameter"><code>in</code></em> to the <em class="parameter"><code>filename</code></em> as CSV (comma-separated values).
2508
The image is written
2509
one line of text per scanline. Complex numbers are written as
2510
"(real,imaginary)" and will need extra parsing I guess. Only the first band
2514
<em class="parameter"><code>separator</code></em> gives the string to use to separate numbers in the output.
2515
The default is "\\t" (tab).
2518
See also: <code class="function">vips_image_write_file()</code>.
2520
<div class="variablelist"><table border="0" class="variablelist">
2522
<col align="left" valign="top">
2527
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
2528
<td>image to save</td>
2531
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2532
<td>file to write to</td>
2535
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2537
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2540
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2541
<td>0 on success, -1 on error.</td>
2547
<div class="refsect2">
2548
<a name="vips-matrixload"></a><h3>vips_matrixload ()</h3>
2549
<pre class="programlisting"><span class="returnvalue">int</span> vips_matrixload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2550
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
2551
<em class="parameter"><code>...</code></em>);</pre>
2553
Reads a matrix from a file.
2556
Matrix files have a simple format that's supposed to be easy to create with
2557
a text editor or a spreadsheet.
2560
The first line has four numbers for width, height, scale and
2561
offset (scale and offset may be omitted, in which case they default to 1.0
2562
and 0.0). Scale must be non-zero. Width and height must be positive
2563
integers. The numbers are separated by any mixture of spaces, commas,
2564
tabs and quotation marks ("). The scale and offset fields may be
2565
floating-point, and must use '.'
2566
as a decimal separator.
2569
Subsequent lines each hold one line of matrix data, with numbers again
2570
separated by any mixture of spaces, commas,
2571
tabs and quotation marks ("). The numbers may be floating-point, and must
2573
as a decimal separator.
2576
Extra characters at the ends of lines or at the end of the file are
2580
See also: <a class="link" href="VipsForeign.html#vips-csvload" title="vips_csvload ()"><code class="function">vips_csvload()</code></a>.
2582
<div class="variablelist"><table border="0" class="variablelist">
2584
<col align="left" valign="top">
2589
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2590
<td>file to load</td>
2593
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
2594
<td>output image</td>
2597
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2599
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2602
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2603
<td>0 on success, -1 on error.</td>
2609
<div class="refsect2">
2610
<a name="vips-matrixsave"></a><h3>vips_matrixsave ()</h3>
2611
<pre class="programlisting"><span class="returnvalue">int</span> vips_matrixsave (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
2612
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2613
<em class="parameter"><code>...</code></em>);</pre>
2615
Write <em class="parameter"><code>in</code></em> to <em class="parameter"><code>filename</code></em> in matrix format. See <a class="link" href="VipsForeign.html#vips-matrixload" title="vips_matrixload ()"><code class="function">vips_matrixload()</code></a> for a
2616
description of the format.
2619
See also: <a class="link" href="VipsForeign.html#vips-matrixload" title="vips_matrixload ()"><code class="function">vips_matrixload()</code></a>.
2621
<div class="variablelist"><table border="0" class="variablelist">
2623
<col align="left" valign="top">
2628
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
2629
<td>image to save</td>
2632
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2633
<td>file to write to</td>
2636
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2638
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2641
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2642
<td>0 on success, -1 on error.</td>
2648
<div class="refsect2">
2649
<a name="vips-matrixprint"></a><h3>vips_matrixprint ()</h3>
2650
<pre class="programlisting"><span class="returnvalue">int</span> vips_matrixprint (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
2651
<em class="parameter"><code>...</code></em>);</pre>
2653
Print <em class="parameter"><code>in</code></em> to <code class="literal">stdout</code> in matrix format. See <a class="link" href="VipsForeign.html#vips-matrixload" title="vips_matrixload ()"><code class="function">vips_matrixload()</code></a> for a
2654
description of the format.
2657
See also: <a class="link" href="VipsForeign.html#vips-matrixload" title="vips_matrixload ()"><code class="function">vips_matrixload()</code></a>.
2659
<div class="variablelist"><table border="0" class="variablelist">
2661
<col align="left" valign="top">
2666
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
2667
<td>image to print</td>
2670
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2672
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2675
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2676
<td>0 on success, -1 on error.</td>
2682
<div class="refsect2">
2683
<a name="vips-magickload"></a><h3>vips_magickload ()</h3>
2684
<pre class="programlisting"><span class="returnvalue">int</span> vips_magickload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2685
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
2686
<em class="parameter"><code>...</code></em>);</pre>
2691
<em class="parameter"><code>all_frames</code></em>: load all frames in sequence
2694
Read in an image using libMagick, the ImageMagick library. This library can
2695
read more than 80 file formats, including SVG, BMP, EPS, DICOM and many
2697
The reader can handle any ImageMagick image, including the float and double
2698
formats. It will work with any quantum size, including HDR. Any metadata
2699
attached to the libMagick image is copied on to the VIPS image.
2702
The reader should also work with most versions of GraphicsMagick. See the
2703
"--with-magickpackage" configure option.
2706
Normally it will only load the first image in a many-image sequence (such
2707
as a GIF). Set <em class="parameter"><code>all_frames</code></em> to true to read the whole image sequence.
2710
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
2712
<div class="variablelist"><table border="0" class="variablelist">
2714
<col align="left" valign="top">
2719
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2720
<td>file to load</td>
2723
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
2724
<td>decompressed image</td>
2727
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2729
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2732
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2733
<td>0 on success, -1 on error.</td>
2739
<div class="refsect2">
2740
<a name="vips-pngload"></a><h3>vips_pngload ()</h3>
2741
<pre class="programlisting"><span class="returnvalue">int</span> vips_pngload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2742
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
2743
<em class="parameter"><code>...</code></em>);</pre>
2748
Read a PNG file into a VIPS image. It can read all png images, including 8-
2749
and 16-bit images, 1 and 3 channel, with and without an alpha channel.
2752
Any ICC profile is read and attached to the VIPS image.
2755
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
2757
<div class="variablelist"><table border="0" class="variablelist">
2759
<col align="left" valign="top">
2764
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2765
<td>file to load</td>
2768
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
2769
<td>decompressed image</td>
2772
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2774
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2777
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2778
<td>0 on success, -1 on error.</td>
2784
<div class="refsect2">
2785
<a name="vips-pngload-buffer"></a><h3>vips_pngload_buffer ()</h3>
2786
<pre class="programlisting"><span class="returnvalue">int</span> vips_pngload_buffer (<em class="parameter"><code><span class="type">void</span> *buf</code></em>,
2787
<em class="parameter"><code><span class="type">size_t</span> len</code></em>,
2788
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
2789
<em class="parameter"><code>...</code></em>);</pre>
2791
Read a PNG-formatted memory block into a VIPS image. It can read all png
2792
images, including 8- and 16-bit images, 1 and 3 channel, with and without
2796
Any ICC profile is read and attached to the VIPS image.
2799
Caution: on return only the header will have been read, the pixel data is
2800
not decompressed until the first pixel is read. Therefore you must not free
2801
<em class="parameter"><code>buf</code></em> until you have read pixel data from <em class="parameter"><code>out</code></em>.
2804
See also: <a class="link" href="VipsForeign.html#vips-pngload" title="vips_pngload ()"><code class="function">vips_pngload()</code></a>.
2806
<div class="variablelist"><table border="0" class="variablelist">
2808
<col align="left" valign="top">
2813
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
2814
<td>memory area to load</td>
2817
<td><p><span class="term"><em class="parameter"><code>len</code></em> :</span></p></td>
2818
<td>size of memory area</td>
2821
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
2822
<td>image to write</td>
2825
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2827
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2830
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2831
<td>0 on success, -1 on error.</td>
2837
<div class="refsect2">
2838
<a name="vips-pngsave"></a><h3>vips_pngsave ()</h3>
2839
<pre class="programlisting"><span class="returnvalue">int</span> vips_pngsave (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
2840
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2841
<em class="parameter"><code>...</code></em>);</pre>
2846
<em class="parameter"><code>compression</code></em>: compression level
2847
<em class="parameter"><code>interlace</code></em>: interlace image
2850
Write a VIPS image to a file as PNG.
2853
<em class="parameter"><code>compression</code></em> means compress with this much effort (0 - 9). Default 6.
2856
Set <em class="parameter"><code>interlace</code></em> to <code class="literal">TRUE</code> to interlace the image with ADAM7
2858
than an interlaced PNG can be up to 7 times slower to write than a
2859
non-interlaced image.
2863
contains an ICC profile named VIPS_META_ICC_NAME ("icc-profile-data"), the
2864
profile from the VIPS header will be attached.
2867
The image is automatically converted to RGB, RGBA, Monochrome or Mono +
2868
alpha before saving. Images with more than one byte per band element are
2869
saved as 16-bit PNG, others are saved as 8-bit PNG.
2872
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
2874
<div class="variablelist"><table border="0" class="variablelist">
2876
<col align="left" valign="top">
2881
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
2882
<td>image to save</td>
2885
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2886
<td>file to write to</td>
2889
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2891
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2894
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2895
<td>0 on success, -1 on error.</td>
2901
<div class="refsect2">
2902
<a name="vips-pngsave-buffer"></a><h3>vips_pngsave_buffer ()</h3>
2903
<pre class="programlisting"><span class="returnvalue">int</span> vips_pngsave_buffer (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
2904
<em class="parameter"><code><span class="type">void</span> **buf</code></em>,
2905
<em class="parameter"><code><span class="type">size_t</span> *len</code></em>,
2906
<em class="parameter"><code>...</code></em>);</pre>
2911
<em class="parameter"><code>compression</code></em>: compression level
2912
<em class="parameter"><code>interlace</code></em>: interlace image
2915
As <a class="link" href="VipsForeign.html#vips-pngsave" title="vips_pngsave ()"><code class="function">vips_pngsave()</code></a>, but save to a memory buffer.
2918
The address of the buffer is returned in <em class="parameter"><code>obuf</code></em>, the length of the buffer in
2919
<em class="parameter"><code>olen</code></em>. You are responsible for freeing the buffer with <code class="function">g_free()</code> when you
2923
See also: <a class="link" href="VipsForeign.html#vips-pngsave" title="vips_pngsave ()"><code class="function">vips_pngsave()</code></a>, <a class="link" href="VipsImage.html#vips-image-write-to-file" title="vips_image_write_to_file ()"><code class="function">vips_image_write_to_file()</code></a>.
2925
<div class="variablelist"><table border="0" class="variablelist">
2927
<col align="left" valign="top">
2932
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
2933
<td>image to save</td>
2936
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
2937
<td>return output buffer here</td>
2940
<td><p><span class="term"><em class="parameter"><code>len</code></em> :</span></p></td>
2941
<td>return output length here</td>
2944
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2946
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2949
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2950
<td>0 on success, -1 on error.</td>
2956
<div class="refsect2">
2957
<a name="vips-ppmload"></a><h3>vips_ppmload ()</h3>
2958
<pre class="programlisting"><span class="returnvalue">int</span> vips_ppmload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
2959
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
2960
<em class="parameter"><code>...</code></em>);</pre>
2962
Read a PPM/PBM/PGM/PFM file into a VIPS image.
2965
It can read 1, 8, 16 and 32 bit images, colour or monochrome,
2966
stored in binary or in ASCII. One bit images become 8 bit VIPS images,
2967
with 0 and 255 for 0 and 1.
2970
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
2972
<div class="variablelist"><table border="0" class="variablelist">
2974
<col align="left" valign="top">
2979
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
2980
<td>file to load</td>
2983
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
2984
<td>output image</td>
2987
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
2989
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
2992
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
2993
<td>0 on success, -1 on error.</td>
2999
<div class="refsect2">
3000
<a name="vips-ppmsave"></a><h3>vips_ppmsave ()</h3>
3001
<pre class="programlisting"><span class="returnvalue">int</span> vips_ppmsave (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
3002
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
3003
<em class="parameter"><code>...</code></em>);</pre>
3008
<em class="parameter"><code>ascii</code></em>: save as ASCII rather than binary
3011
Write a VIPS image to a file as PPM. It can write 8, 16 or
3012
32 bit unsigned integer images, float images, colour or monochrome,
3013
stored as binary or ASCII.
3014
Integer images of more than 8 bits can only be stored in ASCII.
3017
When writing float (PFM) images the scale factor is set from the
3018
"pfm-scale" metadata.
3021
Set <em class="parameter"><code>ascii</code></em> to <code class="literal">TRUE</code> to write as human-readable ASCII. Normally data is
3025
The storage format is indicated by a filename extension. Use one of .pbm,
3029
See also: <code class="function">vips_image_write_file()</code>.
3031
<div class="variablelist"><table border="0" class="variablelist">
3033
<col align="left" valign="top">
3038
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
3039
<td>image to save</td>
3042
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
3043
<td>file to write to</td>
3046
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
3048
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
3051
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
3052
<td>0 on success, -1 on error.</td>
3058
<div class="refsect2">
3059
<a name="vips-matload"></a><h3>vips_matload ()</h3>
3060
<pre class="programlisting"><span class="returnvalue">int</span> vips_matload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
3061
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
3062
<em class="parameter"><code>...</code></em>);</pre>
3064
Read a Matlab save file into a VIPS image.
3067
This operation searches the save
3068
file for the first array variable with between 1 and 3 dimensions and loads
3069
it as an image. It will not handle complex images. It does not handle
3073
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
3075
<div class="variablelist"><table border="0" class="variablelist">
3077
<col align="left" valign="top">
3082
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
3083
<td>file to load</td>
3086
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
3087
<td>output image</td>
3090
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
3092
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
3095
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
3096
<td>0 on success, -1 on error.</td>
3102
<div class="refsect2">
3103
<a name="vips-radload"></a><h3>vips_radload ()</h3>
3104
<pre class="programlisting"><span class="returnvalue">int</span> vips_radload (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
3105
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> **out</code></em>,
3106
<em class="parameter"><code>...</code></em>);</pre>
3108
Read a Radiance (HDR) file into a VIPS image.
3111
Radiance files are read as <a class="link" href="VipsImage.html#VIPS-CODING-RAD:CAPS"><span class="type">VIPS_CODING_RAD</span></a>. They have one byte for each of
3112
red, green and blue, and one byte of shared exponent. Some operations (like
3113
<a class="link" href="libvips-conversion.html#vips-extract-area" title="vips_extract_area ()"><code class="function">vips_extract_area()</code></a>) can work directly with images in this format, but
3114
mmany (all the arithmetic operations, for example) will not. Unpack
3115
<a class="link" href="VipsImage.html#VIPS-CODING-RAD:CAPS"><span class="type">VIPS_CODING_RAD</span></a> images to 3 band float with <a href="http://http://www.vips.ecs.soton.ac.uk/libvips-colour.html#im-rad2float"><code class="function">im_rad2float()</code></a> if you want to do
3119
This operation ignores some header fields, like VIEW and DATE. It will not
3120
rotate/flip as the FORMAT string asks.
3123
Sections of this reader from Greg Ward and Radiance with kind permission.
3126
See also: <a class="link" href="VipsImage.html#vips-image-new-from-file" title="vips_image_new_from_file ()"><code class="function">vips_image_new_from_file()</code></a>.
3128
<div class="variablelist"><table border="0" class="variablelist">
3130
<col align="left" valign="top">
3135
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
3136
<td>file to load</td>
3139
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
3140
<td>output image</td>
3143
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
3145
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
3148
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
3149
<td>0 on success, -1 on error.</td>
3155
<div class="refsect2">
3156
<a name="vips-radsave"></a><h3>vips_radsave ()</h3>
3157
<pre class="programlisting"><span class="returnvalue">int</span> vips_radsave (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
3158
<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
3159
<em class="parameter"><code>...</code></em>);</pre>
3161
Write a VIPS image in Radiance (HDR) format.
3164
Sections of this reader from Greg Ward and Radiance with kind permission.
3167
See also: <code class="function">vips_image_write_file()</code>.
3169
<div class="variablelist"><table border="0" class="variablelist">
3171
<col align="left" valign="top">
3176
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
3177
<td>image to save</td>
3180
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
3181
<td>file to write to</td>
3184
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
3186
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
3189
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
3190
<td>0 on success, -1 on error.</td>
3196
<div class="refsect2">
3197
<a name="VipsForeignDzLayout"></a><h3>enum VipsForeignDzLayout</h3>
3198
<pre class="programlisting">typedef enum {
3199
VIPS_FOREIGN_DZ_LAYOUT_DZ,
3200
VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY,
3201
VIPS_FOREIGN_DZ_LAYOUT_GOOGLE,
3202
VIPS_FOREIGN_DZ_LAYOUT_LAST
3203
} VipsForeignDzLayout;
3206
What directory layout and metadata standard to use.
3208
<div class="variablelist"><table border="0" class="variablelist">
3210
<col align="left" valign="top">
3215
<td><p><a name="VIPS-FOREIGN-DZ-LAYOUT-DZ:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_DZ_LAYOUT_DZ</code></span></p></td>
3216
<td>use DeepZoom directory layout
3220
<td><p><a name="VIPS-FOREIGN-DZ-LAYOUT-ZOOMIFY:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY</code></span></p></td>
3221
<td>use Zoomify directory layout
3225
<td><p><a name="VIPS-FOREIGN-DZ-LAYOUT-GOOGLE:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_DZ_LAYOUT_GOOGLE</code></span></p></td>
3226
<td>use Google maps directory layout
3230
<td><p><a name="VIPS-FOREIGN-DZ-LAYOUT-LAST:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_DZ_LAYOUT_LAST</code></span></p></td>
3238
<div class="refsect2">
3239
<a name="VipsForeignDzDepth"></a><h3>enum VipsForeignDzDepth</h3>
3240
<pre class="programlisting">typedef enum {
3241
VIPS_FOREIGN_DZ_DEPTH_1PIXEL,
3242
VIPS_FOREIGN_DZ_DEPTH_1TILE,
3243
VIPS_FOREIGN_DZ_DEPTH_1,
3244
VIPS_FOREIGN_DZ_DEPTH_LAST
3245
} VipsForeignDzDepth;
3248
How many pyramid layers to create.
3250
<div class="variablelist"><table border="0" class="variablelist">
3252
<col align="left" valign="top">
3257
<td><p><a name="VIPS-FOREIGN-DZ-DEPTH-1PIXEL:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_DZ_DEPTH_1PIXEL</code></span></p></td>
3258
<td>create layers down to 1x1 pixel
3262
<td><p><a name="VIPS-FOREIGN-DZ-DEPTH-1TILE:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_DZ_DEPTH_1TILE</code></span></p></td>
3263
<td>create layers down to 1x1 tile
3267
<td><p><a name="VIPS-FOREIGN-DZ-DEPTH-1:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_DZ_DEPTH_1</code></span></p></td>
3268
<td>only create a single layer
3272
<td><p><a name="VIPS-FOREIGN-DZ-DEPTH-LAST:CAPS"></a><span class="term"><code class="literal">VIPS_FOREIGN_DZ_DEPTH_LAST</code></span></p></td>
3280
<div class="refsect2">
3281
<a name="vips-dzsave"></a><h3>vips_dzsave ()</h3>
3282
<pre class="programlisting"><span class="returnvalue">int</span> vips_dzsave (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
3283
<em class="parameter"><code>const <span class="type">char</span> *basename</code></em>,
3284
<em class="parameter"><code>...</code></em>);</pre>
3289
<em class="parameter"><code>layout</code></em>; directory layout convention
3290
<em class="parameter"><code>suffix</code></em>: suffix for tile tiles
3291
<em class="parameter"><code>overlap</code></em>; set tile overlap
3292
<em class="parameter"><code>tile_size</code></em>; set tile size
3293
<em class="parameter"><code>background</code></em>: background colour
3294
<em class="parameter"><code>depth</code></em>: how deep to make the pyramid
3295
<em class="parameter"><code>centre</code></em>: centre the tiles
3296
<em class="parameter"><code>angle</code></em>: rotate the image by this much
3299
Save an image as a set of tiles at various resolutions. By default dzsave
3300
uses DeepZoom layout -- use <em class="parameter"><code>layout</code></em> to pick other conventions.
3303
In DeepZoom layout a directory called
3304
"<em class="parameter"><code>basename_files</code></em>" is created to hold the tiles, and an XML file called
3305
"<em class="parameter"><code>basename.dzi</code></em>" is written with the image metadata,
3308
In Zoomify and Google layout, a directory called <em class="parameter"><code>basename</code></em> is created to
3309
hold the tile structure.
3312
You can set <em class="parameter"><code>suffix</code></em> to something like ".jpg[Q=85]" to control the tile write
3316
In Google layout mode, edge tiles are expanded to <em class="parameter"><code>tile_size</code></em> by <em class="parameter"><code>tile_size</code></em>
3317
pixels. Normally they are filled with white, but you can set another colour
3318
with <em class="parameter"><code>background</code></em>. Images are usually placed at the top-left of the tile,
3319
but you can have them centred by turning on <em class="parameter"><code>centre</code></em>.
3322
You can set the size and overlap of tiles with <em class="parameter"><code>tile_size</code></em> and <em class="parameter"><code>overlap</code></em>.
3323
They default to the correct settings for the selected <em class="parameter"><code>layout</code></em>.
3326
Use <em class="parameter"><code>depth</code></em> to control how low the pyramid goes. This defaults to the
3327
correct setting for the <em class="parameter"><code>layout</code></em> you select.
3330
See also: <a class="link" href="VipsForeign.html#vips-tiffsave" title="vips_tiffsave ()"><code class="function">vips_tiffsave()</code></a>.
3332
<div class="variablelist"><table border="0" class="variablelist">
3334
<col align="left" valign="top">
3339
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
3340
<td>image to save</td>
3343
<td><p><span class="term"><em class="parameter"><code>basename</code></em> :</span></p></td>
3344
<td>basename to save to</td>
3347
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
3349
<code class="literal">NULL</code>-terminated list of optional named arguments</td>
3352
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
3353
<td>0 on success, -1 on error.</td>
3359
<div class="refsect1">
3360
<a name="VipsForeign.property-details"></a><h2>Property Details</h2>
3361
<div class="refsect2">
3362
<a name="VipsForeignLoad--access"></a><h3>The <code class="literal">"access"</code> property</h3>
3363
<pre class="programlisting"> "access" <a class="link" href="VipsImage.html#VipsAccess" title="enum VipsAccess"><span class="type">VipsAccess</span></a> : Read / Write</pre>
3364
<p>Required access pattern for this file.</p>
3365
<p>Default value: VIPS_ACCESS_RANDOM</p>
3368
<div class="refsect2">
3369
<a name="VipsForeignLoad--disc"></a><h3>The <code class="literal">"disc"</code> property</h3>
3370
<pre class="programlisting"> "disc" <span class="type">gboolean</span> : Read / Write</pre>
3371
<p>Open to disc.</p>
3372
<p>Default value: TRUE</p>
3375
<div class="refsect2">
3376
<a name="VipsForeignLoad--flags"></a><h3>The <code class="literal">"flags"</code> property</h3>
3377
<pre class="programlisting"> "flags" <a class="link" href="VipsForeign.html#VipsForeignFlags" title="enum VipsForeignFlags"><span class="type">VipsForeignFlags</span></a> : Read / Write</pre>
3378
<p>Flags for this file.</p>
3381
<div class="refsect2">
3382
<a name="VipsForeignLoad--out"></a><h3>The <code class="literal">"out"</code> property</h3>
3383
<pre class="programlisting"> "out" <a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a>* : Read / Write</pre>
3384
<p>Output image.</p>
3387
<div class="refsect2">
3388
<a name="VipsForeignLoad--sequential"></a><h3>The <code class="literal">"sequential"</code> property</h3>
3389
<pre class="programlisting"> "sequential" <span class="type">gboolean</span> : Read / Write</pre>
3390
<p>Sequential read only.</p>
3391
<p>Default value: FALSE</p>
3394
<div class="refsect2">
3395
<a name="VipsForeignSave--in"></a><h3>The <code class="literal">"in"</code> property</h3>
3396
<pre class="programlisting"> "in" <a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a>* : Read / Write</pre>
3397
<p>Image to save.</p>
3400
<div class="refsect2">
3401
<a name="VipsForeignSave--strip"></a><h3>The <code class="literal">"strip"</code> property</h3>
3402
<pre class="programlisting"> "strip" <span class="type">gboolean</span> : Read / Write</pre>
3403
<p>Strip all metadata from image.</p>
3404
<p>Default value: FALSE</p>
3407
<div class="refsect1">
3408
<a name="VipsForeign.see-also"></a><h2>See Also</h2>
3412
<div class="footer">
3414
Generated by GTK-Doc V1.19</div>
b'\\ No newline at end of file'