1 /* image header funcs
2  *
3  * 20/9/09
4  * 	- from proto.h
5  */
6 
7 /*
8 
9     This file is part of VIPS.
10 
11     VIPS is free software; you can redistribute it and/or modify
12     it under the terms of the GNU Lesser General Public License as published by
13     the Free Software Foundation; either version 2 of the License, or
14     (at your option) any later version.
15 
16     This program is distributed in the hope that it will be useful,
17     but WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19     GNU Lesser General Public License for more details.
20 
21     You should have received a copy of the GNU Lesser General Public License
22     along with this program; if not, write to the Free Software
23     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24     02110-1301  USA
25 
26  */
27 
28 /*
29 
30     These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
31 
32  */
33 
34 #ifndef VIPS_HEADER_H
35 #define VIPS_HEADER_H
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /*__cplusplus*/
40 
41 /**
42  * VIPS_META_EXIF_NAME:
43  *
44  * The name that JPEG read and write operations use for the image's EXIF data.
45  */
46 #define VIPS_META_EXIF_NAME "exif-data"
47 
48 /**
49  * VIPS_META_XMP_NAME:
50  *
51  * The name that read and write operations use for the image's XMP data.
52  */
53 #define VIPS_META_XMP_NAME "xmp-data"
54 
55 /**
56  * VIPS_META_IPTC_NAME:
57  *
58  * The name that read and write operations use for the image's IPTC data.
59  */
60 #define VIPS_META_IPTC_NAME "iptc-data"
61 
62 /**
63  * VIPS_META_PHOTOSHOP_NAME:
64  *
65  * The name that TIFF read and write operations use for the image's
66  * TIFFTAG_PHOTOSHOP data.
67  */
68 #define VIPS_META_PHOTOSHOP_NAME "photoshop-data"
69 
70 /**
71  * VIPS_META_ICC_NAME:
72  *
73  * The name we use to attach an ICC profile. The file read and write
74  * operations for TIFF, JPEG, PNG and others use this item of metadata to
75  * attach and save ICC profiles. The profile is updated by the
76  * vips_icc_transform() operations.
77  */
78 #define VIPS_META_ICC_NAME "icc-profile-data"
79 
80 /**
81  * VIPS_META_IMAGEDESCRIPTION:
82  *
83  * The IMAGEDESCRIPTION tag. Often has useful metadata.
84  */
85 #define VIPS_META_IMAGEDESCRIPTION "image-description"
86 
87 /**
88  * VIPS_META_RESOLUTION_UNIT:
89  *
90  * The JPEG and TIFF read and write operations use this to record the
91  * file's preferred unit for resolution.
92  */
93 #define VIPS_META_RESOLUTION_UNIT "resolution-unit"
94 
95 /**
96  * VIPS_META_LOADER:
97  *
98  * Record the name of the original loader here. Handy for hinting file formats
99  * and for debugging.
100  */
101 #define VIPS_META_LOADER "vips-loader"
102 
103 /**
104  * VIPS_META_SEQUENTIAL:
105  *
106  * Images loaded via vips_sequential() have this int field defined. Some
107  * operations (eg. vips_shrinkv()) add extra caches if they see it on their
108  * input.
109  */
110 #define VIPS_META_SEQUENTIAL "vips-sequential"
111 
112 /**
113  * VIPS_META_ORIENTATION:
114  *
115  * The orientation tag for this image. An int from 1 - 8 using the standard
116  * exif/tiff meanings.
117  *
118  * * 1 - The 0th row represents the visual top of the image, and the 0th column
119  *   represents the visual left-hand side.
120  * * 2 - The 0th row represents the visual top of the image, and the 0th column
121  *   represents the visual right-hand side.
122  * * 3 - The 0th row represents the visual bottom of the image, and the 0th
123  *   column represents the visual right-hand side.
124  * * 4 - The 0th row represents the visual bottom of the image, and the 0th
125  *   column represents the visual left-hand side.
126  * * 5 - The 0th row represents the visual left-hand side of the image, and the
127  *   0th column represents the visual top.
128  * * 6 - The 0th row represents the visual right-hand side of the image, and the
129  *   0th column represents the visual top.
130  * * 7 - The 0th row represents the visual right-hand side of the image, and the
131  *   0th column represents the visual bottom.
132  * * 8 - The 0th row represents the visual left-hand side of the image, and the
133  *   0th column represents the visual bottom.
134  */
135 #define VIPS_META_ORIENTATION "orientation"
136 
137 /**
138  * VIPS_META_PAGE_HEIGHT:
139  *
140  * If set, the height of each page when this image was loaded. If you save an
141  * image with "page-height" set to a format that supports multiple pages, such
142  * as tiff, the image will be saved as a series of pages.
143  */
144 #define VIPS_META_PAGE_HEIGHT "page-height"
145 
146 /**
147  * VIPS_META_N_PAGES:
148  *
149  * If set, the number of pages in the original file.
150  */
151 #define VIPS_META_N_PAGES "n-pages"
152 
153 /**
154  * VIPS_META_N_SUBIFDS:
155  *
156  * If set, the number of subifds in the first page of the file.
157  */
158 #define VIPS_META_N_SUBIFDS "n-subifds"
159 
160 guint64 vips_format_sizeof( VipsBandFormat format );
161 guint64 vips_format_sizeof_unsafe( VipsBandFormat format );
162 
163 int vips_image_get_width( const VipsImage *image );
164 int vips_image_get_height( const VipsImage *image );
165 int vips_image_get_bands( const VipsImage *image );
166 VipsBandFormat vips_image_get_format( const VipsImage *image );
167 double vips_image_get_format_max( VipsBandFormat format );
168 VipsBandFormat vips_image_guess_format( const VipsImage *image );
169 VipsCoding vips_image_get_coding( const VipsImage *image );
170 VipsInterpretation vips_image_get_interpretation( const VipsImage *image );
171 VipsInterpretation vips_image_guess_interpretation( const VipsImage *image );
172 double vips_image_get_xres( const VipsImage *image );
173 double vips_image_get_yres( const VipsImage *image );
174 int vips_image_get_xoffset( const VipsImage *image );
175 int vips_image_get_yoffset( const VipsImage *image );
176 const char *vips_image_get_filename( const VipsImage *image );
177 const char *vips_image_get_mode( const VipsImage *image );
178 double vips_image_get_scale( const VipsImage *image );
179 double vips_image_get_offset( const VipsImage *image );
180 int vips_image_get_page_height( VipsImage *image );
181 int vips_image_get_n_pages( VipsImage *image );
182 int vips_image_get_n_subifds( VipsImage *image );
183 int vips_image_get_orientation( VipsImage *image );
184 gboolean vips_image_get_orientation_swap( VipsImage *image );
185 const void *vips_image_get_data( VipsImage *image );
186 
187 void vips_image_init_fields( VipsImage *image,
188 	int xsize, int ysize, int bands,
189 	VipsBandFormat format, VipsCoding coding,
190 	VipsInterpretation interpretation,
191 	double xres, double yres );
192 
193 void vips_image_set( VipsImage *image, const char *name, GValue *value );
194 int vips_image_get( const VipsImage *image,
195 	const char *name, GValue *value_copy );
196 int vips_image_get_as_string( const VipsImage *image,
197 	const char *name, char **out );
198 GType vips_image_get_typeof( const VipsImage *image, const char *name );
199 gboolean vips_image_remove( VipsImage *image, const char *name );
200 typedef void *(*VipsImageMapFn)( VipsImage *image,
201 	const char *name, GValue *value, void *a );
202 void *vips_image_map( VipsImage *image, VipsImageMapFn fn, void *a );
203 gchar **vips_image_get_fields( VipsImage *image );
204 
205 void vips_image_set_area( VipsImage *image,
206 	const char *name, VipsCallbackFn free_fn, void *data );
207 int vips_image_get_area( const VipsImage *image,
208 	const char *name, const void **data );
209 void vips_image_set_blob( VipsImage *image,
210 	const char *name,
211 	VipsCallbackFn free_fn, const void *data, size_t length );
212 void vips_image_set_blob_copy( VipsImage *image,
213 	const char *name, const void *data, size_t length );
214 int vips_image_get_blob( const VipsImage *image,
215 	const char *name, const void **data, size_t *length );
216 
217 int vips_image_get_int( const VipsImage *image, const char *name, int *out );
218 void vips_image_set_int( VipsImage *image, const char *name, int i );
219 int vips_image_get_double( const VipsImage *image,
220 	const char *name, double *out );
221 void vips_image_set_double( VipsImage *image, const char *name, double d );
222 int vips_image_get_string( const VipsImage *image,
223 	const char *name, const char **out );
224 void vips_image_set_string( VipsImage *image,
225 	const char *name, const char *str );
226 void vips_image_print_field( const VipsImage *image, const char *field );
227 int vips_image_get_image( const VipsImage *image,
228 	const char *name, VipsImage **out );
229 void vips_image_set_image( VipsImage *image, const char *name, VipsImage *im );
230 void vips_image_set_array_int( VipsImage *image, const char *name,
231 	const int *array, int n );
232 int vips_image_get_array_int( VipsImage *image, const char *name,
233 	int **out, int *n );
234 int vips_image_get_array_double( VipsImage *image, const char *name,
235 	double **out, int *n );
236 void vips_image_set_array_double( VipsImage *image, const char *name,
237 	const double *array, int n );
238 
239 int vips_image_history_printf( VipsImage *image, const char *format, ... )
240 	__attribute__((format(printf, 2, 3)));
241 int vips_image_history_args( VipsImage *image,
242 	const char *name, int argc, char *argv[] );
243 const char *vips_image_get_history( VipsImage *image );
244 
245 #ifdef __cplusplus
246 }
247 #endif /*__cplusplus*/
248 
249 #endif /*VIPS_HEADER_H*/
250