1 /* Base type for supported image formats. Subclass this to add a new 2 * format. 3 */ 4 5 /* 6 7 This file is part of VIPS. 8 9 VIPS is free software; you can redistribute it and/or modify 10 it under the terms of the GNU Lesser General Public License as published by 11 the Free Software Foundation; either version 2 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU Lesser General Public License for more details. 18 19 You should have received a copy of the GNU Lesser General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 02110-1301 USA 23 24 */ 25 26 /* 27 28 These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk 29 30 */ 31 32 #ifndef VIPS_FOREIGN_H 33 #define VIPS_FOREIGN_H 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif /*__cplusplus*/ 38 39 #define VIPS_TYPE_FOREIGN (vips_foreign_get_type()) 40 #define VIPS_FOREIGN( obj ) \ 41 (G_TYPE_CHECK_INSTANCE_CAST( (obj), \ 42 VIPS_TYPE_FOREIGN, VipsForeign )) 43 #define VIPS_FOREIGN_CLASS( klass ) \ 44 (G_TYPE_CHECK_CLASS_CAST( (klass), \ 45 VIPS_TYPE_FOREIGN, VipsForeignClass)) 46 #define VIPS_IS_FOREIGN( obj ) \ 47 (G_TYPE_CHECK_INSTANCE_TYPE( (obj), VIPS_TYPE_FOREIGN )) 48 #define VIPS_IS_FOREIGN_CLASS( klass ) \ 49 (G_TYPE_CHECK_CLASS_TYPE( (klass), VIPS_TYPE_FOREIGN )) 50 #define VIPS_FOREIGN_GET_CLASS( obj ) \ 51 (G_TYPE_INSTANCE_GET_CLASS( (obj), \ 52 VIPS_TYPE_FOREIGN, VipsForeignClass )) 53 54 typedef struct _VipsForeign { 55 VipsOperation parent_object; 56 57 /*< public >*/ 58 59 } VipsForeign; 60 61 typedef struct _VipsForeignClass { 62 VipsOperationClass parent_class; 63 64 /*< public >*/ 65 66 /* Loop over formats in this order, default 0. We need this because 67 * some formats can be read by several loaders (eg. tiff can be read 68 * by the libMagick loader as well as by the tiff loader), and we want 69 * to make sure the better loader comes first. 70 */ 71 int priority; 72 73 /* Null-terminated list of recommended suffixes, eg. ".tif", ".tiff". 74 * This can be used by both load and save, so it's in the base class. 75 */ 76 const char **suffs; 77 78 } VipsForeignClass; 79 80 /* Don't put spaces around void here, it breaks gtk-doc. 81 */ 82 GType vips_foreign_get_type(void); 83 84 /* Map over and find formats. This uses type introspection to loop over 85 * subclasses of VipsForeign. 86 */ 87 void *vips_foreign_map( const char *base, 88 VipsSListMap2Fn fn, void *a, void *b ); 89 90 /* Image file load properties. 91 * 92 * Keep in sync with the deprecated VipsFormatFlags, we need to be able to 93 * cast between them. 94 */ 95 typedef enum /*< flags >*/ { 96 VIPS_FOREIGN_NONE = 0, /* No flags set */ 97 VIPS_FOREIGN_PARTIAL = 1, /* Lazy read OK (eg. tiled tiff) */ 98 VIPS_FOREIGN_BIGENDIAN = 2, /* Most-significant byte first */ 99 VIPS_FOREIGN_SEQUENTIAL = 4, /* Top-to-bottom lazy read OK */ 100 VIPS_FOREIGN_ALL = 7 /* All flags set */ 101 } VipsForeignFlags; 102 103 /** 104 * VipsFailOn: 105 * @VIPS_FAIL_ON_NONE: never stop 106 * @VIPS_FAIL_ON_TRUNCATED: stop on image truncated, nothing else 107 * @VIPS_FAIL_ON_ERROR: stop on serious error or truncation 108 * @VIPS_FAIL_ON_WARNING: stop on anything, even warnings 109 * 110 * How sensitive loaders are to errors, from never stop (very insensitive), to 111 * stop on the smallest warning (very sensitive). 112 * 113 * Each one implies the ones before it, so #VIPS_FAIL_ON_ERROR implies 114 * #VIPS_FAIL_ON_TRUNCATED. 115 */ 116 typedef enum { 117 VIPS_FAIL_ON_NONE, 118 VIPS_FAIL_ON_TRUNCATED, 119 VIPS_FAIL_ON_ERROR, 120 VIPS_FAIL_ON_WARNING, 121 VIPS_FAIL_ON_LAST 122 } VipsFailOn; 123 124 #define VIPS_TYPE_FOREIGN_LOAD (vips_foreign_load_get_type()) 125 #define VIPS_FOREIGN_LOAD( obj ) \ 126 (G_TYPE_CHECK_INSTANCE_CAST( (obj), \ 127 VIPS_TYPE_FOREIGN_LOAD, VipsForeignLoad )) 128 #define VIPS_FOREIGN_LOAD_CLASS( klass ) \ 129 (G_TYPE_CHECK_CLASS_CAST( (klass), \ 130 VIPS_TYPE_FOREIGN_LOAD, VipsForeignLoadClass)) 131 #define VIPS_IS_FOREIGN_LOAD( obj ) \ 132 (G_TYPE_CHECK_INSTANCE_TYPE( (obj), VIPS_TYPE_FOREIGN_LOAD )) 133 #define VIPS_IS_FOREIGN_LOAD_CLASS( klass ) \ 134 (G_TYPE_CHECK_CLASS_TYPE( (klass), VIPS_TYPE_FOREIGN_LOAD )) 135 #define VIPS_FOREIGN_LOAD_GET_CLASS( obj ) \ 136 (G_TYPE_INSTANCE_GET_CLASS( (obj), \ 137 VIPS_TYPE_FOREIGN_LOAD, VipsForeignLoadClass )) 138 139 typedef struct _VipsForeignLoad { 140 VipsForeign parent_object; 141 /*< private >*/ 142 143 /* Set TRUE to force open via memory. 144 */ 145 gboolean memory; 146 147 /* Type of access upstream wants and the loader must supply. 148 */ 149 VipsAccess access; 150 151 /* Flags for this load operation. 152 */ 153 VipsForeignFlags flags; 154 155 /* Behaviour on error. 156 */ 157 VipsFailOn fail_on; 158 159 /* Deprecated and unused. Just here for compat. 160 */ 161 gboolean fail; 162 gboolean sequential; 163 164 /*< public >*/ 165 166 /* The image we generate. This must be set by ->header(). 167 */ 168 VipsImage *out; 169 170 /* The behind-the-scenes real image we decompress to. This can be a 171 * disc file or a memory buffer. This must be set by ->load(). 172 */ 173 VipsImage *real; 174 175 /* Set this to tag the operation as nocache. 176 */ 177 gboolean nocache; 178 179 /* Deprecated: the memory option used to be called disc and default 180 * TRUE. 181 */ 182 gboolean disc; 183 184 /* Set if a start function fails. We want to prevent the other starts 185 * from also triggering the load. 186 */ 187 gboolean error; 188 } VipsForeignLoad; 189 190 typedef struct _VipsForeignLoadClass { 191 VipsForeignClass parent_class; 192 /*< public >*/ 193 194 /* Is a file in this format. 195 * 196 * This function should return %TRUE if the file contains an image of 197 * this type. If you don't define this function, #VipsForeignLoad 198 * will use @suffs instead. 199 */ 200 gboolean (*is_a)( const char *filename ); 201 202 /* Is a buffer in this format. 203 * 204 * This function should return %TRUE if the buffer contains an image of 205 * this type. 206 */ 207 gboolean (*is_a_buffer)( const void *data, size_t size ); 208 209 /* Is a stream in this format. 210 * 211 * This function should return %TRUE if the stream contains an image of 212 * this type. 213 */ 214 gboolean (*is_a_source)( VipsSource *source ); 215 216 /* Get the flags from a filename. 217 * 218 * This function should examine the file and return a set 219 * of flags. If you don't define it, vips will default to 0 (no flags 220 * set). 221 * 222 * This method is necessary for vips7 compatibility. Don't define 223 * it if you don't need vips7. 224 */ 225 VipsForeignFlags (*get_flags_filename)( const char *filename ); 226 227 /* Get the flags for this load operation. Images can be loaded from 228 * (for example) memory areas rather than files, so you can't just use 229 * @get_flags_filename(). 230 */ 231 VipsForeignFlags (*get_flags)( VipsForeignLoad *load ); 232 233 /* Do the minimum read we can. 234 * 235 * Set the header fields in @out from @filename. If you can read the 236 * whole image as well with no performance cost (as with vipsload), 237 * or if your loader does not support reading only the header, read 238 * the entire image in this method and leave @load() NULL. 239 * 240 * @header() needs to set the dhint on the image .. otherwise you get 241 * the default SMALLTILE. 242 * 243 * Return 0 for success, -1 for error, setting vips_error(). 244 */ 245 int (*header)( VipsForeignLoad *load ); 246 247 /* Read the whole image into @real. The pixels will get copied to @out 248 * later. 249 * 250 * You can omit this method if you define a @header() method which 251 * loads the whole file. 252 * 253 * Return 0 for success, -1 for error, setting 254 * vips_error(). 255 */ 256 int (*load)( VipsForeignLoad *load ); 257 } VipsForeignLoadClass; 258 259 /* Don't put spaces around void here, it breaks gtk-doc. 260 */ 261 GType vips_foreign_load_get_type(void); 262 263 const char *vips_foreign_find_load( const char *filename ); 264 const char *vips_foreign_find_load_buffer( const void *data, size_t size ); 265 const char *vips_foreign_find_load_source( VipsSource *source ); 266 267 VipsForeignFlags vips_foreign_flags( const char *loader, const char *filename ); 268 gboolean vips_foreign_is_a( const char *loader, const char *filename ); 269 gboolean vips_foreign_is_a_buffer( const char *loader, 270 const void *data, size_t size ); 271 gboolean vips_foreign_is_a_source( const char *loader, 272 VipsSource *source ); 273 274 void vips_foreign_load_invalidate( VipsImage *image ); 275 276 #define VIPS_TYPE_FOREIGN_SAVE (vips_foreign_save_get_type()) 277 #define VIPS_FOREIGN_SAVE( obj ) \ 278 (G_TYPE_CHECK_INSTANCE_CAST( (obj), \ 279 VIPS_TYPE_FOREIGN_SAVE, VipsForeignSave )) 280 #define VIPS_FOREIGN_SAVE_CLASS( klass ) \ 281 (G_TYPE_CHECK_CLASS_CAST( (klass), \ 282 VIPS_TYPE_FOREIGN_SAVE, VipsForeignSaveClass)) 283 #define VIPS_IS_FOREIGN_SAVE( obj ) \ 284 (G_TYPE_CHECK_INSTANCE_TYPE( (obj), VIPS_TYPE_FOREIGN_SAVE )) 285 #define VIPS_IS_FOREIGN_SAVE_CLASS( klass ) \ 286 (G_TYPE_CHECK_CLASS_TYPE( (klass), VIPS_TYPE_FOREIGN_SAVE )) 287 #define VIPS_FOREIGN_SAVE_GET_CLASS( obj ) \ 288 (G_TYPE_INSTANCE_GET_CLASS( (obj), \ 289 VIPS_TYPE_FOREIGN_SAVE, VipsForeignSaveClass )) 290 291 /** 292 * VipsSaveable: 293 * @VIPS_SAVEABLE_MONO: 1 band (eg. CSV) 294 * @VIPS_SAVEABLE_RGB: 1 or 3 bands (eg. PPM) 295 * @VIPS_SAVEABLE_RGBA: 1, 2, 3 or 4 bands (eg. PNG) 296 * @VIPS_SAVEABLE_RGBA_ONLY: 3 or 4 bands (eg. WEBP) 297 * @VIPS_SAVEABLE_RGB_CMYK: 1, 3 or 4 bands (eg. JPEG) 298 * @VIPS_SAVEABLE_ANY: any number of bands (eg. TIFF) 299 * 300 * See also: #VipsForeignSave. 301 */ 302 typedef enum { 303 VIPS_SAVEABLE_MONO, 304 VIPS_SAVEABLE_RGB, 305 VIPS_SAVEABLE_RGBA, 306 VIPS_SAVEABLE_RGBA_ONLY, 307 VIPS_SAVEABLE_RGB_CMYK, 308 VIPS_SAVEABLE_ANY, 309 VIPS_SAVEABLE_LAST 310 } VipsSaveable; 311 312 typedef struct _VipsForeignSave { 313 VipsForeign parent_object; 314 315 /* Don't attach metadata. 316 */ 317 gboolean strip; 318 319 /* If flattening out alpha, the background colour to use. Default to 320 * 0 (black). 321 */ 322 VipsArrayDouble *background; 323 324 /* Set to non-zero to set the page size for multi-page save. 325 */ 326 int page_height; 327 328 /*< public >*/ 329 330 /* The image we are to save, as supplied by our caller. 331 */ 332 VipsImage *in; 333 334 /* @in converted to a saveable format (eg. 8-bit RGB) according to the 335 * instructions you give in the class fields below. 336 * 337 * This is the image you should actually write to the output. 338 */ 339 VipsImage *ready; 340 341 } VipsForeignSave; 342 343 typedef struct _VipsForeignSaveClass { 344 VipsForeignClass parent_class; 345 346 /*< public >*/ 347 348 /* How this format treats bands. 349 * 350 * @saveable describes the bands that your saver can handle. For 351 * example, PPM images can have 1 or 3 bands (mono or RGB), so it 352 * uses #VIPS_SAVEABLE_RGB. 353 */ 354 VipsSaveable saveable; 355 356 /* How this format treats band formats. 357 * 358 * @format_table describes the band formats that your saver can 359 * handle. For each of the 10 #VipsBandFormat values, the array 360 * should give the format your saver will accept. 361 */ 362 VipsBandFormat *format_table; 363 364 /* The set of coding types this format can save. For example, jpeg can 365 * only save NONE, so has NONE TRUE and RAD and LABQ FALSE. 366 * 367 * Default NONE TRUE, RAD and LABQ FALSE. 368 */ 369 gboolean coding[VIPS_CODING_LAST]; 370 } VipsForeignSaveClass; 371 372 /* Don't put spaces around void here, it breaks gtk-doc. 373 */ 374 GType vips_foreign_save_get_type(void); 375 376 const char *vips_foreign_find_save( const char *filename ); 377 gchar **vips_foreign_get_suffixes( void ); 378 const char *vips_foreign_find_save_buffer( const char *suffix ); 379 const char *vips_foreign_find_save_target( const char *suffix ); 380 381 int vips_vipsload( const char *filename, VipsImage **out, ... ) 382 __attribute__((sentinel)); 383 int vips_vipsload_source( VipsSource *source, VipsImage **out, ... ) 384 __attribute__((sentinel)); 385 int vips_vipssave( VipsImage *in, const char *filename, ... ) 386 __attribute__((sentinel)); 387 int vips_vipssave_target( VipsImage *in, VipsTarget *target, ... ) 388 __attribute__((sentinel)); 389 390 int vips_openslideload( const char *filename, VipsImage **out, ... ) 391 __attribute__((sentinel)); 392 int vips_openslideload_source( VipsSource *source, VipsImage **out, ... ) 393 __attribute__((sentinel)); 394 395 /** 396 * VipsForeignSubsample: 397 * @VIPS_FOREIGN_SUBSAMPLE_AUTO: prevent subsampling when quality >= 90 398 * @VIPS_FOREIGN_SUBSAMPLE_ON: always perform subsampling 399 * @VIPS_FOREIGN_SUBSAMPLE_OFF: never perform subsampling 400 * 401 * Set subsampling mode. 402 */ 403 typedef enum { 404 VIPS_FOREIGN_SUBSAMPLE_AUTO, 405 VIPS_FOREIGN_SUBSAMPLE_ON, 406 VIPS_FOREIGN_SUBSAMPLE_OFF, 407 VIPS_FOREIGN_SUBSAMPLE_LAST 408 } VipsForeignSubsample; 409 410 /** 411 * VipsForeignJpegSubsample: 412 * @VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO: default preset 413 * @VIPS_FOREIGN_JPEG_SUBSAMPLE_ON: always perform subsampling 414 * @VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF: never perform subsampling 415 * 416 * Set jpeg subsampling mode. 417 * 418 * DEPRECATED: use #VipsForeignSubsample 419 */ 420 typedef enum { 421 VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO, 422 VIPS_FOREIGN_JPEG_SUBSAMPLE_ON, 423 VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF, 424 VIPS_FOREIGN_JPEG_SUBSAMPLE_LAST 425 } VipsForeignJpegSubsample; 426 427 int vips_jpegload( const char *filename, VipsImage **out, ... ) 428 __attribute__((sentinel)); 429 int vips_jpegload_buffer( void *buf, size_t len, VipsImage **out, ... ) 430 __attribute__((sentinel)); 431 int vips_jpegload_source( VipsSource *source, VipsImage **out, ... ) 432 __attribute__((sentinel)); 433 434 int vips_jpegsave_target( VipsImage *in, VipsTarget *target, ... ) 435 __attribute__((sentinel)); 436 int vips_jpegsave( VipsImage *in, const char *filename, ... ) 437 __attribute__((sentinel)); 438 int vips_jpegsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) 439 __attribute__((sentinel)); 440 int vips_jpegsave_mime( VipsImage *in, ... ) 441 __attribute__((sentinel)); 442 443 /** 444 * VipsForeignWebpPreset: 445 * @VIPS_FOREIGN_WEBP_PRESET_DEFAULT: default preset 446 * @VIPS_FOREIGN_WEBP_PRESET_PICTURE: digital picture, like portrait, inner shot 447 * @VIPS_FOREIGN_WEBP_PRESET_PHOTO: outdoor photograph, with natural lighting 448 * @VIPS_FOREIGN_WEBP_PRESET_DRAWING: hand or line drawing, with high-contrast details 449 * @VIPS_FOREIGN_WEBP_PRESET_ICON: small-sized colorful images 450 * @VIPS_FOREIGN_WEBP_PRESET_TEXT: text-like 451 * 452 * Tune lossy encoder settings for different image types. 453 */ 454 typedef enum { 455 VIPS_FOREIGN_WEBP_PRESET_DEFAULT, 456 VIPS_FOREIGN_WEBP_PRESET_PICTURE, 457 VIPS_FOREIGN_WEBP_PRESET_PHOTO, 458 VIPS_FOREIGN_WEBP_PRESET_DRAWING, 459 VIPS_FOREIGN_WEBP_PRESET_ICON, 460 VIPS_FOREIGN_WEBP_PRESET_TEXT, 461 VIPS_FOREIGN_WEBP_PRESET_LAST 462 } VipsForeignWebpPreset; 463 464 int vips_webpload_source( VipsSource *source, VipsImage **out, ... ) 465 __attribute__((sentinel)); 466 int vips_webpload( const char *filename, VipsImage **out, ... ) 467 __attribute__((sentinel)); 468 int vips_webpload_buffer( void *buf, size_t len, VipsImage **out, ... ) 469 __attribute__((sentinel)); 470 471 int vips_webpsave_target( VipsImage *in, VipsTarget *target, ... ) 472 __attribute__((sentinel)); 473 int vips_webpsave( VipsImage *in, const char *filename, ... ) 474 __attribute__((sentinel)); 475 int vips_webpsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) 476 __attribute__((sentinel)); 477 int vips_webpsave_mime( VipsImage *in, ... ) 478 __attribute__((sentinel)); 479 480 /** 481 * VipsForeignTiffCompression: 482 * @VIPS_FOREIGN_TIFF_COMPRESSION_NONE: no compression 483 * @VIPS_FOREIGN_TIFF_COMPRESSION_JPEG: jpeg compression 484 * @VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE: deflate (zip) compression 485 * @VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS: packbits compression 486 * @VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4: fax4 compression 487 * @VIPS_FOREIGN_TIFF_COMPRESSION_LZW: LZW compression 488 * @VIPS_FOREIGN_TIFF_COMPRESSION_WEBP: WEBP compression 489 * @VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD: ZSTD compression 490 * @VIPS_FOREIGN_TIFF_COMPRESSION_JP2K: JP2K compression 491 * 492 * The compression types supported by the tiff writer. 493 * 494 * Use @Q to set the jpeg compression level, default 75. 495 * 496 * Use @predictor to set the lzw or deflate prediction, default horizontal. 497 * 498 * Use @lossless to set WEBP lossless compression. 499 * 500 * Use @level to set webp and zstd compression level. 501 */ 502 typedef enum { 503 VIPS_FOREIGN_TIFF_COMPRESSION_NONE, 504 VIPS_FOREIGN_TIFF_COMPRESSION_JPEG, 505 VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE, 506 VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS, 507 VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4, 508 VIPS_FOREIGN_TIFF_COMPRESSION_LZW, 509 VIPS_FOREIGN_TIFF_COMPRESSION_WEBP, 510 VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD, 511 VIPS_FOREIGN_TIFF_COMPRESSION_JP2K, 512 VIPS_FOREIGN_TIFF_COMPRESSION_LAST 513 } VipsForeignTiffCompression; 514 515 /** 516 * VipsForeignTiffPredictor: 517 * @VIPS_FOREIGN_TIFF_PREDICTOR_NONE: no prediction 518 * @VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL: horizontal differencing 519 * @VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT: float predictor 520 * 521 * The predictor can help deflate and lzw compression. The values are fixed by 522 * the tiff library. 523 */ 524 typedef enum { 525 VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1, 526 VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2, 527 VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3, 528 VIPS_FOREIGN_TIFF_PREDICTOR_LAST 529 } VipsForeignTiffPredictor; 530 531 /** 532 * VipsForeignTiffResunit: 533 * @VIPS_FOREIGN_TIFF_RESUNIT_CM: use centimeters 534 * @VIPS_FOREIGN_TIFF_RESUNIT_INCH: use inches 535 * 536 * Use inches or centimeters as the resolution unit for a tiff file. 537 */ 538 typedef enum { 539 VIPS_FOREIGN_TIFF_RESUNIT_CM, 540 VIPS_FOREIGN_TIFF_RESUNIT_INCH, 541 VIPS_FOREIGN_TIFF_RESUNIT_LAST 542 } VipsForeignTiffResunit; 543 544 int vips_tiffload( const char *filename, VipsImage **out, ... ) 545 __attribute__((sentinel)); 546 int vips_tiffload_buffer( void *buf, size_t len, VipsImage **out, ... ) 547 __attribute__((sentinel)); 548 int vips_tiffload_source( VipsSource *source, VipsImage **out, ... ) 549 __attribute__((sentinel)); 550 int vips_tiffsave( VipsImage *in, const char *filename, ... ) 551 __attribute__((sentinel)); 552 int vips_tiffsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) 553 __attribute__((sentinel)); 554 555 int vips_openexrload( const char *filename, VipsImage **out, ... ) 556 __attribute__((sentinel)); 557 558 int vips_fitsload( const char *filename, VipsImage **out, ... ) 559 __attribute__((sentinel)); 560 int vips_fitssave( VipsImage *in, const char *filename, ... ) 561 __attribute__((sentinel)); 562 563 int vips_analyzeload( const char *filename, VipsImage **out, ... ) 564 __attribute__((sentinel)); 565 566 int vips_rawload( const char *filename, VipsImage **out, 567 int width, int height, int bands, ... ) 568 __attribute__((sentinel)); 569 int vips_rawsave( VipsImage *in, const char *filename, ... ) 570 __attribute__((sentinel)); 571 int vips_rawsave_fd( VipsImage *in, int fd, ... ) 572 __attribute__((sentinel)); 573 574 int vips_csvload( const char *filename, VipsImage **out, ... ) 575 __attribute__((sentinel)); 576 int vips_csvload_source( VipsSource *source, VipsImage **out, ... ) 577 __attribute__((sentinel)); 578 int vips_csvsave( VipsImage *in, const char *filename, ... ) 579 __attribute__((sentinel)); 580 int vips_csvsave_target( VipsImage *in, VipsTarget *target, ... ) 581 __attribute__((sentinel)); 582 583 int vips_matrixload( const char *filename, VipsImage **out, ... ) 584 __attribute__((sentinel)); 585 int vips_matrixload_source( VipsSource *source, VipsImage **out, ... ) 586 __attribute__((sentinel)); 587 int vips_matrixsave( VipsImage *in, const char *filename, ... ) 588 __attribute__((sentinel)); 589 int vips_matrixsave_target( VipsImage *in, VipsTarget *target, ... ) 590 __attribute__((sentinel)); 591 int vips_matrixprint( VipsImage *in, ... ) 592 __attribute__((sentinel)); 593 594 int vips_magickload( const char *filename, VipsImage **out, ... ) 595 __attribute__((sentinel)); 596 int vips_magickload_buffer( void *buf, size_t len, VipsImage **out, ... ) 597 __attribute__((sentinel)); 598 int vips_magicksave( VipsImage *in, const char *filename, ... ) 599 __attribute__((sentinel)); 600 int vips_magicksave_buffer( VipsImage *in, void **buf, size_t *len, ... ) 601 __attribute__((sentinel)); 602 603 /** 604 * VipsForeignPngFilter: 605 * @VIPS_FOREIGN_PNG_FILTER_NONE: no filtering 606 * @VIPS_FOREIGN_PNG_FILTER_SUB: difference to the left 607 * @VIPS_FOREIGN_PNG_FILTER_UP: difference up 608 * @VIPS_FOREIGN_PNG_FILTER_AVG: average of left and up 609 * @VIPS_FOREIGN_PNG_FILTER_PAETH: pick best neighbor predictor automatically 610 * @VIPS_FOREIGN_PNG_FILTER_ALL: adaptive 611 * 612 * http://www.w3.org/TR/PNG-Filters.html 613 * The values mirror those of png.h in libpng. 614 */ 615 typedef enum /*< flags >*/ { 616 VIPS_FOREIGN_PNG_FILTER_NONE = 0x08, 617 VIPS_FOREIGN_PNG_FILTER_SUB = 0x10, 618 VIPS_FOREIGN_PNG_FILTER_UP = 0x20, 619 VIPS_FOREIGN_PNG_FILTER_AVG = 0x40, 620 VIPS_FOREIGN_PNG_FILTER_PAETH = 0x80, 621 VIPS_FOREIGN_PNG_FILTER_ALL = 0xF8 622 } VipsForeignPngFilter; 623 624 int vips_pngload_source( VipsSource *source, VipsImage **out, ... ) 625 __attribute__((sentinel)); 626 int vips_pngload( const char *filename, VipsImage **out, ... ) 627 __attribute__((sentinel)); 628 int vips_pngload_buffer( void *buf, size_t len, VipsImage **out, ... ) 629 __attribute__((sentinel)); 630 int vips_pngsave_target( VipsImage *in, VipsTarget *target, ... ) 631 __attribute__((sentinel)); 632 int vips_pngsave( VipsImage *in, const char *filename, ... ) 633 __attribute__((sentinel)); 634 int vips_pngsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) 635 __attribute__((sentinel)); 636 637 /** 638 * VipsForeignPpmFormat: 639 * @VIPS_FOREIGN_PPM_FORMAT_PBM: portable bitmap 640 * @VIPS_FOREIGN_PPM_FORMAT_PGM: portable greymap 641 * @VIPS_FOREIGN_PPM_FORMAT_PPM: portable pixmap 642 * @VIPS_FOREIGN_PPM_FORMAT_PFM: portable float map 643 * 644 * The netpbm file format to save as. 645 * 646 * #VIPS_FOREIGN_PPM_FORMAT_PBM images are single bit. 647 * 648 * #VIPS_FOREIGN_PPM_FORMAT_PGM images are 8, 16, or 32-bits, one band. 649 * 650 * #VIPS_FOREIGN_PPM_FORMAT_PPM images are 8, 16, or 32-bits, three bands. 651 * 652 * #VIPS_FOREIGN_PPM_FORMAT_PFM images are 32-bit float pixels. 653 */ 654 typedef enum { 655 VIPS_FOREIGN_PPM_FORMAT_PBM, 656 VIPS_FOREIGN_PPM_FORMAT_PGM, 657 VIPS_FOREIGN_PPM_FORMAT_PPM, 658 VIPS_FOREIGN_PPM_FORMAT_PFM, 659 VIPS_FOREIGN_PPM_FORMAT_LAST 660 } VipsForeignPpmFormat; 661 662 int vips_ppmload( const char *filename, VipsImage **out, ... ) 663 __attribute__((sentinel)); 664 int vips_ppmload_source( VipsSource *source, VipsImage **out, ... ) 665 __attribute__((sentinel)); 666 int vips_ppmsave( VipsImage *in, const char *filename, ... ) 667 __attribute__((sentinel)); 668 int vips_ppmsave_target( VipsImage *in, VipsTarget *target, ... ) 669 __attribute__((sentinel)); 670 671 int vips_matload( const char *filename, VipsImage **out, ... ) 672 __attribute__((sentinel)); 673 674 int vips_radload_source( VipsSource *source, VipsImage **out, ... ) 675 __attribute__((sentinel)); 676 int vips_radload( const char *filename, VipsImage **out, ... ) 677 __attribute__((sentinel)); 678 int vips_radload_buffer( void *buf, size_t len, VipsImage **out, ... ) 679 __attribute__((sentinel)); 680 int vips_radsave( VipsImage *in, const char *filename, ... ) 681 __attribute__((sentinel)); 682 int vips_radsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) 683 __attribute__((sentinel)); 684 int vips_radsave_target( VipsImage *in, VipsTarget *target, ... ) 685 __attribute__((sentinel)); 686 687 int vips_pdfload( const char *filename, VipsImage **out, ... ) 688 __attribute__((sentinel)); 689 int vips_pdfload_buffer( void *buf, size_t len, VipsImage **out, ... ) 690 __attribute__((sentinel)); 691 int vips_pdfload_source( VipsSource *source, VipsImage **out, ... ) 692 __attribute__((sentinel)); 693 694 int vips_svgload( const char *filename, VipsImage **out, ... ) 695 __attribute__((sentinel)); 696 int vips_svgload_buffer( void *buf, size_t len, VipsImage **out, ... ) 697 __attribute__((sentinel)); 698 int vips_svgload_string( const char *str, VipsImage **out, ... ) 699 __attribute__((sentinel)); 700 int vips_svgload_source( VipsSource *source, VipsImage **out, ... ) 701 __attribute__((sentinel)); 702 703 int vips_gifload( const char *filename, VipsImage **out, ... ) 704 __attribute__((sentinel)); 705 int vips_gifload_buffer( void *buf, size_t len, VipsImage **out, ... ) 706 __attribute__((sentinel)); 707 int vips_gifload_source( VipsSource *source, VipsImage **out, ... ) 708 __attribute__((sentinel)); 709 710 int vips_gifsave( VipsImage *in, const char *filename, ... ) 711 __attribute__((sentinel)); 712 int vips_gifsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) 713 __attribute__((sentinel)); 714 int vips_gifsave_target( VipsImage *in, VipsTarget *target, ... ) 715 __attribute__((sentinel)); 716 717 int vips_heifload( const char *filename, VipsImage **out, ... ) 718 __attribute__((sentinel)); 719 int vips_heifload_buffer( void *buf, size_t len, VipsImage **out, ... ) 720 __attribute__((sentinel)); 721 int vips_heifload_source( VipsSource *source, VipsImage **out, ... ) 722 __attribute__((sentinel)); 723 int vips_heifsave( VipsImage *in, const char *filename, ... ) 724 __attribute__((sentinel)); 725 int vips_heifsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) 726 __attribute__((sentinel)); 727 int vips_heifsave_target( VipsImage *in, VipsTarget *target, ... ) 728 __attribute__((sentinel)); 729 730 int vips_niftiload( const char *filename, VipsImage **out, ... ) 731 __attribute__((sentinel)); 732 int vips_niftiload_source( VipsSource *source, VipsImage **out, ... ) 733 __attribute__((sentinel)); 734 int vips_niftisave( VipsImage *in, const char *filename, ... ) 735 __attribute__((sentinel)); 736 737 int vips_jp2kload( const char *filename, VipsImage **out, ... ) 738 __attribute__((sentinel)); 739 int vips_jp2kload_buffer( void *buf, size_t len, VipsImage **out, ... ) 740 __attribute__((sentinel)); 741 int vips_jp2kload_source( VipsSource *source, VipsImage **out, ... ) 742 __attribute__((sentinel)); 743 int vips_jp2ksave( VipsImage *in, const char *filename, ... ) 744 __attribute__((sentinel)); 745 int vips_jp2ksave_buffer( VipsImage *in, void **buf, size_t *len, ... ) 746 __attribute__((sentinel)); 747 int vips_jp2ksave_target( VipsImage *in, VipsTarget *target, ... ) 748 __attribute__((sentinel)); 749 750 int vips_jxlload_source( VipsSource *source, VipsImage **out, ... ) 751 __attribute__((sentinel)); 752 int vips_jxlload_buffer( void *buf, size_t len, VipsImage **out, ... ) 753 __attribute__((sentinel)); 754 int vips_jxlload( const char *filename, VipsImage **out, ... ) 755 __attribute__((sentinel)); 756 int vips_jxlsave( VipsImage *in, const char *filename, ... ) 757 __attribute__((sentinel)); 758 int vips_jxlsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) 759 __attribute__((sentinel)); 760 int vips_jxlsave_target( VipsImage *in, VipsTarget *target, ... ) 761 __attribute__((sentinel)); 762 763 /** 764 * VipsForeignDzLayout: 765 * @VIPS_FOREIGN_DZ_LAYOUT_DZ: use DeepZoom directory layout 766 * @VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY: use Zoomify directory layout 767 * @VIPS_FOREIGN_DZ_LAYOUT_GOOGLE: use Google maps directory layout 768 * @VIPS_FOREIGN_DZ_LAYOUT_IIIF: use IIIF v2 directory layout 769 * @VIPS_FOREIGN_DZ_LAYOUT_IIIF3: use IIIF v3 directory layout 770 * 771 * What directory layout and metadata standard to use. 772 */ 773 typedef enum { 774 VIPS_FOREIGN_DZ_LAYOUT_DZ, 775 VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY, 776 VIPS_FOREIGN_DZ_LAYOUT_GOOGLE, 777 VIPS_FOREIGN_DZ_LAYOUT_IIIF, 778 VIPS_FOREIGN_DZ_LAYOUT_IIIF3, 779 VIPS_FOREIGN_DZ_LAYOUT_LAST 780 } VipsForeignDzLayout; 781 782 /** 783 * VipsForeignDzDepth: 784 * @VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL: create layers down to 1x1 pixel 785 * @VIPS_FOREIGN_DZ_DEPTH_ONETILE: create layers down to 1x1 tile 786 * @VIPS_FOREIGN_DZ_DEPTH_ONE: only create a single layer 787 * 788 * How many pyramid layers to create. 789 */ 790 typedef enum { 791 VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL, 792 VIPS_FOREIGN_DZ_DEPTH_ONETILE, 793 VIPS_FOREIGN_DZ_DEPTH_ONE, 794 VIPS_FOREIGN_DZ_DEPTH_LAST 795 } VipsForeignDzDepth; 796 797 /** 798 * VipsForeignDzContainer: 799 * @VIPS_FOREIGN_DZ_CONTAINER_FS: write tiles to the filesystem 800 * @VIPS_FOREIGN_DZ_CONTAINER_ZIP: write tiles to a zip file 801 * @VIPS_FOREIGN_DZ_CONTAINER_SZI: write to a szi file 802 * 803 * How many pyramid layers to create. 804 */ 805 typedef enum { 806 VIPS_FOREIGN_DZ_CONTAINER_FS, 807 VIPS_FOREIGN_DZ_CONTAINER_ZIP, 808 VIPS_FOREIGN_DZ_CONTAINER_SZI, 809 VIPS_FOREIGN_DZ_CONTAINER_LAST 810 } VipsForeignDzContainer; 811 812 int vips_dzsave( VipsImage *in, const char *name, ... ) 813 __attribute__((sentinel)); 814 815 /** 816 * VipsForeignHeifCompression: 817 * @VIPS_FOREIGN_HEIF_COMPRESSION_HEVC: x265 818 * @VIPS_FOREIGN_HEIF_COMPRESSION_AVC: x264 819 * @VIPS_FOREIGN_HEIF_COMPRESSION_JPEG: jpeg 820 * @VIPS_FOREIGN_HEIF_COMPRESSION_AV1: aom 821 * 822 * The compression format to use inside a HEIF container. 823 * 824 * This is assumed to use the same numbering as %heif_compression_format. 825 */ 826 typedef enum { 827 VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1, 828 VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2, 829 VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3, 830 VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4, 831 VIPS_FOREIGN_HEIF_COMPRESSION_LAST 832 } VipsForeignHeifCompression; 833 834 #ifdef __cplusplus 835 } 836 #endif /*__cplusplus*/ 837 838 #endif /*VIPS_FOREIGN_H*/ 839