1 // VIPS image wrapper
2 
3 /*
4 
5     This file is part of VIPS.
6 
7     VIPS is free software; you can redistribute it and/or modify
8     it under the terms of the GNU Lesser General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.
11 
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU Lesser General Public License for more details.
16 
17     You should have received a copy of the GNU Lesser General Public License
18     along with this program; if not, write to the Free Software
19     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20     02110-1301  USA
21 
22  */
23 
24 /*
25 
26     These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
27 
28  */
29 
30 #ifndef VIPS_VIMAGE_H
31 #define VIPS_VIMAGE_H
32 
33 #include <list>
34 #include <complex>
35 #include <vector>
36 
37 #include <cstring>
38 
39 #include <vips/vips.h>
40 
41 VIPS_NAMESPACE_START
42 
43 /* Small utility things.
44  */
45 
46 VIPS_CPLUSPLUS_API std::vector<double> to_vectorv( int n, ... );
47 VIPS_CPLUSPLUS_API std::vector<double> to_vector( double value );
48 VIPS_CPLUSPLUS_API std::vector<double> to_vector( int n, double array[] );
49 VIPS_CPLUSPLUS_API std::vector<double> negate( std::vector<double> value );
50 VIPS_CPLUSPLUS_API std::vector<double> invert( std::vector<double> value );
51 
52 /**
53  * Whether or not VObject should take over the reference that you pass in. See
54  * VObject().
55  */
56 enum VSteal {
57 	NOSTEAL = 0,
58 	STEAL = 1
59 };
60 
61 /**
62  * A smart VipsObject pointer. It calls g_object_ref()/_unref() for you
63  * automatically.
64  *
65  * VObjects can be null (have no value set). See is_null().
66  */
67 class VObject
68 {
69 private:
70 	// can be NULL, see eg. VObject()
71 	VipsObject *vobject;
72 
73 public:
74 	/**
75 	 * Wrap a VObject around the underlying VipsObject pointer.
76 	 *
77 	 * If steal is STEAL, then the new VObject takes over the reference
78 	 * that you pass in.
79 	 */
80 	VObject( VipsObject *new_vobject, VSteal steal = STEAL ) :
vobject(new_vobject)81 		vobject( new_vobject )
82 	{
83 		// we allow NULL init, eg. "VImage a;"
84 		g_assert( !new_vobject ||
85 			VIPS_IS_OBJECT( new_vobject ) );
86 
87 #ifdef VIPS_DEBUG_VERBOSE
88 		printf( "VObject constructor, obj = %p, steal = %d\n",
89 			new_vobject, steal );
90 		if( new_vobject ) {
91 			printf( "   obj " );
92 			vips_object_print_name( VIPS_OBJECT( new_vobject ) );
93 			printf( "\n" );
94 		}
95 #endif /*VIPS_DEBUG_VERBOSE*/
96 
97 		if( !steal && vobject ) {
98 #ifdef VIPS_DEBUG_VERBOSE
99 			printf( "   reffing object\n" );
100 #endif /*VIPS_DEBUG_VERBOSE*/
101 			g_object_ref( vobject );
102 		}
103 	}
104 
VObject()105 	VObject() :
106 		vobject( 0 )
107 	{
108 	}
109 
VObject(const VObject & a)110 	VObject( const VObject &a ) :
111 		vobject( a.vobject )
112 	{
113 		g_assert( !vobject ||
114 			VIPS_IS_OBJECT( vobject ) );
115 
116 #ifdef VIPS_DEBUG_VERBOSE
117 		printf( "VObject copy constructor, obj = %p\n",
118 			vobject );
119 		printf( "   reffing object\n" );
120 #endif /*VIPS_DEBUG_VERBOSE*/
121 		if( vobject )
122 			g_object_ref( vobject );
123 	}
124 
125 	// assignment ... we must delete the old ref
126 	VObject &operator=( const VObject &a )
127 	{
128 #ifdef VIPS_DEBUG_VERBOSE
129 		printf( "VObject assignment\n" );
130 		printf( "   reffing %p\n", a.vobject );
131 		printf( "   unreffing %p\n", vobject );
132 #endif /*VIPS_DEBUG_VERBOSE*/
133 
134 		g_assert( !vobject ||
135 			VIPS_IS_OBJECT( vobject ) );
136 		g_assert( !a.vobject ||
137 			VIPS_IS_OBJECT( a.vobject ) );
138 
139 		// delete the old ref at the end ... otherwise "a = a;" could
140 		// unref before reffing again
141 		if( a.vobject )
142 			g_object_ref( a.vobject );
143 		if( vobject )
144 			g_object_unref( vobject );
145 		vobject = a.vobject;
146 
147 		return( *this );
148 	}
149 
150 	// this mustn't be virtual: we want this class to only be a pointer,
151 	// no vtable allowed
~VObject()152 	~VObject()
153 	{
154 #ifdef VIPS_DEBUG_VERBOSE
155 		printf( "VObject destructor\n" );
156 		printf( "   unreffing %p\n", vobject );
157 #endif /*VIPS_DEBUG_VERBOSE*/
158 
159 		g_assert( !vobject ||
160 			VIPS_IS_OBJECT( vobject ) );
161 
162 		if( vobject )
163 			g_object_unref( vobject );
164 	}
165 
166 	/**
167 	 * Return the underlying VipsObject pointer. This does not make a new
168 	 * reference -- you'll need to g_object_ref() the result if you want
169 	 * to keep it.
170 	 */
171 	VipsObject *
get_object()172 	get_object() const
173 	{
174 		g_assert( !vobject ||
175 			VIPS_IS_OBJECT( vobject ) );
176 
177 		return( vobject );
178 	}
179 
180 	/**
181 	 * TRUE if this is a null VObject.
182 	 */
is_null()183 	bool is_null() const
184 	{
185 		return vobject == 0;
186 	}
187 
188 };
189 
190 class VIPS_CPLUSPLUS_API VImage;
191 class VIPS_CPLUSPLUS_API VInterpolate;
192 class VIPS_CPLUSPLUS_API VSource;
193 class VIPS_CPLUSPLUS_API VTarget;
194 class VIPS_CPLUSPLUS_API VOption;
195 
196 /**
197  * A list of name-value pairs. Pass these to libvips operations to set
198  * options. For example:
199  *
200  *     VImage out = in.embed( 10, 10, 1000, 1000, VImage::option()
201  *         ->set( "extend", "background" )
202  *         ->set( "background", 128 ) );
203  *
204  * The `set` member functions will take copies (or hold references to)
205  * compound objects, so you can free them immediately afterwards if necessary.
206  *
207  * You can get values back from operations by using the * form of the set
208  * member functions. For example:
209  *
210  *     VImage in = VImage::new_from_file( argv[1] );
211  *     int x, y;
212  *     double value = in.max( VImage::option()
213  *         set( "x", &x )
214  *         set( "y", &y ) );
215  *
216  */
217 class VOption {
218 private:
219 	struct Pair {
220 		const char *name;
221 
222 		// the thing we pass to and from our caller
223 		GValue value;
224 
225 		// an input or output parameter ... we guess the direction
226 		// from the arg to set()
227 		bool input;
228 
229 		// the pointer we write output values to
230 		union {
231 			bool *vbool;
232 			int *vint;
233 			double *vdouble;
234 			VImage *vimage;
235 			std::vector<double> *vvector;
236 			VipsBlob **vblob;
237 		};
238 
PairPair239 		Pair( const char *name ) :
240 			name( name ), input( false ), vimage( 0 )
241 		{
242 			// argh = {0} won't work wil vanilla C++
243 			memset( &value, 0, sizeof( GValue ) );
244 		}
245 
~PairPair246 		~Pair()
247 		{
248 			g_value_unset( &value );
249 		}
250 	};
251 
252 	std::list<Pair *> options;
253 
254 public:
VOption()255 	VOption()
256 	{
257 	}
258 
259 	virtual ~VOption();
260 
261 	/**
262 	 * Set an input boolean option.
263 	 */
264 	VOption *
265 	set( const char *name, bool value );
266 
267 	/**
268 	 * Set an input int option. This is used for enums as well, or you can
269 	 * use the string version.
270 	 */
271 	VOption *
272 	set( const char *name, int value );
273 
274 	/**
275 	 * Set an input unsigned 64-bit integer option.
276 	 */
277 	VOption *
278 	set( const char *name, guint64 value );
279 
280 	/**
281 	 * Set an input double option.
282 	 */
283 	VOption *
284 	set( const char *name, double value );
285 
286 	/**
287 	 * Set an input string option.
288 	 *
289 	 * A copy is taken of the object.
290 	 */
291 	VOption *
292 	set( const char *name, const char *value );
293 
294 	/**
295 	 * Set a libvips object as an option. These can be images, sources,
296 	 * targets, etc.
297 	 *
298 	 * A copy is taken of the object.
299 	 */
300 	VOption *
301 	set( const char *name, const VObject value );
302 
303 	/**
304 	 * Set an array of integers as an input option.
305 	 *
306 	 * A copy is taken of the object.
307 	 */
308 	VOption *
309 	set( const char *name, std::vector<int> value );
310 
311 	/**
312 	 * Set an array of doubles as an input option.
313 	 *
314 	 * A copy is taken of the object.
315 	 */
316 	VOption *
317 	set( const char *name, std::vector<double> value );
318 
319 	/**
320 	 * Set an array of images as an input option.
321 	 *
322 	 * A copy is taken of the object.
323 	 */
324 	VOption *
325 	set( const char *name, std::vector<VImage> value );
326 
327 	/**
328 	 * Set a binary object an input option. Use vips_blob_new() to make
329 	 * blobs.
330 	 *
331 	 * A copy is taken of the object.
332 	 */
333 	VOption *
334 	set( const char *name, VipsBlob *value );
335 
336 	/**
337 	 * Set an option which will return a bool value.
338 	 */
339 	VOption *
340 	set( const char *name, bool *value );
341 
342 	/**
343 	 * Set an option which will return an integer value.
344 	 */
345 	VOption *
346 	set( const char *name, int *value );
347 
348 	/**
349 	 * Set an option which will return a double value.
350 	 */
351 	VOption *
352 	set( const char *name, double *value );
353 
354 	/**
355 	 * Set an option which will return a reference to an image.
356 	 */
357 	VOption *
358 	set( const char *name, VImage *value );
359 
360 	/**
361 	 * Set an option which will return an array of doubles.
362 	 */
363 	VOption *
364 	set( const char *name, std::vector<double> *value );
365 
366 	/**
367 	 * Set an option which will return a binary object, such as an ICC
368 	 * profile.
369 	 */
370 	VOption *
371 	set( const char *name, VipsBlob **blob );
372 
373 	/**
374 	 * Walk the set of options, setting options on the operation. This is
375 	 * used internally by VImage::call().
376 	 */
377 	void
378 	set_operation( VipsOperation *operation );
379 
380 	/**
381 	 * Walk the set of options, fetching any output values. This is used
382 	 * internally by VImage::call().
383 	 */
384 	void
385 	get_operation( VipsOperation *operation );
386 
387 };
388 
389 /**
390  * An image object.
391  *
392  * Image processing operations on images are member functions of VImage. For
393  * example:
394  *
395  *     VImage in = VImage::new_from_file( argv[1], VImage::option()
396  *         ->set( "access", "sequential" ) );
397  *     VImage out = in.embed( 10, 10, 1000, 1000, VImage::option()
398  *         ->set( "extend", "copy" ) );
399  *     out.write_to_file( argv[2] );
400  *
401  * VImage objects are smart pointers over the underlying VipsImage objects.
402  * They manage the complications of GLib's ref and unref system for you.
403  */
404 class VImage : public VObject
405 {
406 public:
407 	using VObject::is_null;
408 
409 	/**
410 	 * Wrap a VImage around an underlying VipsImage object.
411 	 *
412 	 * If steal is STEAL, then the VImage will take ownership of the
413 	 * reference to the VipsImage.
414 	 */
415 	VImage( VipsImage *image, VSteal steal = STEAL ) :
416 		VObject( (VipsObject *) image, steal )
417 	{
418 	}
419 
420 	/**
421 	 * An empty (NULL) VImage, eg. "VImage a;"
422 	 */
VImage()423 	VImage() :
424 		VObject( 0 )
425 	{
426 	}
427 
428 	/**
429 	 * Return the underlying VipsImage reference that this VImage holds.
430 	 * This does not make a new reference -- you'll need to g_object_ref()
431 	 * the pointer if you need it to last.
432 	 */
433 	VipsImage *
get_image()434 	get_image() const
435 	{
436 		return( (VipsImage *) VObject::get_object() );
437 	}
438 
439 	/**
440 	 * Return the width of the image in pixels.
441 	 */
442 	int
width()443 	width() const
444 	{
445 		return( vips_image_get_width( get_image() ) );
446 	}
447 
448 	/**
449 	 * Return the height of the image in pixels.
450 	 */
451 	int
height()452 	height() const
453 	{
454 		return( vips_image_get_height( get_image() ) );
455 	}
456 
457 	/**
458 	 * Return the number of image bands.
459 	 */
460 	int
bands()461 	bands() const
462 	{
463 		return( vips_image_get_bands( get_image() ) );
464 	}
465 
466 	/**
467 	 * Return the image format, for example VIPS_FORMAT_UCHAR.
468 	 */
469 	VipsBandFormat
format()470 	format() const
471 	{
472 		return( vips_image_get_format( get_image() ) );
473 	}
474 
475 	/**
476 	 * Return the image coding, for example VIPS_CODING_NONE.
477 	 */
478 	VipsCoding
coding()479 	coding() const
480 	{
481 		return( vips_image_get_coding( get_image() ) );
482 	}
483 
484 	/**
485 	 * Return the image interpretation, for example
486 	 * VIPS_INTERPRETATION_sRGB.
487 	 */
488 	VipsInterpretation
interpretation()489 	interpretation() const
490 	{
491 		return( vips_image_get_interpretation( get_image() ) );
492 	}
493 
494 	/**
495 	 * Try to guess the image interpretation from other fields. This is
496 	 * handy if the interpretation has not been set correctly.
497 	 */
498 	VipsInterpretation
guess_interpretation()499 	guess_interpretation() const
500 	{
501 		return( vips_image_guess_interpretation( get_image() ) );
502 	}
503 
504 	/**
505 	 * The horizontal resolution in pixels per millimeter.
506 	 */
507 	double
xres()508 	xres() const
509 	{
510 		return( vips_image_get_xres( get_image() ) );
511 	}
512 
513 	/**
514 	 * The vertical resolution in pixels per millimeter.
515 	 */
516 	double
yres()517 	yres() const
518 	{
519 		return( vips_image_get_yres( get_image() ) );
520 	}
521 
522 	/**
523 	 * The horizontal offset of the origin in pixels.
524 	 */
525 	int
xoffset()526 	xoffset() const
527 	{
528 		return( vips_image_get_xoffset( get_image() ) );
529 	}
530 
531 	/**
532 	 * The vertical offset of the origin in pixels.
533 	 */
534 	int
yoffset()535 	yoffset() const
536 	{
537 		return( vips_image_get_yoffset( get_image() ) );
538 	}
539 
540 	/**
541 	 * TRUE if the image has an alpha channel.
542 	 */
543 	bool
has_alpha()544 	has_alpha() const
545 	{
546 		return( vips_image_hasalpha( get_image() ) );
547 	}
548 
549 	/**
550 	 * The name of the file this image originally came from, or NULL if
551 	 * it's not a file image.
552 	 */
553 	const char *
filename()554 	filename() const
555 	{
556 		return( vips_image_get_filename( get_image() ) );
557 	}
558 
559 	/**
560 	 * Arrange for the underlying object to be entirely in memory, then
561 	 * return a pointer to the first pixel.
562 	 *
563 	 * This can take a long time and need a very large amount of RAM.
564 	 */
565 	const void *
data()566 	data() const
567 	{
568 		return( vips_image_get_data( get_image() ) );
569 	}
570 
571 	/**
572 	 * Set the value of an int metadata item on an image.
573 	 */
574 	void
set(const char * field,int value)575 	set( const char *field, int value )
576 	{
577 		vips_image_set_int( this->get_image(), field, value );
578 	}
579 
580 	/**
581 	 * Set the value of an int array metadata item on an image.
582 	 *
583 	 * A copy of the array is taken.
584 	 */
585 	void
set(const char * field,int * value,int n)586 	set( const char *field, int *value, int n )
587 	{
588 		vips_image_set_array_int( this->get_image(), field, value, n );
589 	}
590 
591 	/**
592 	 * Set the value of an int array metadata item on an image.
593 	 *
594 	 * A copy of the array is taken.
595 	 */
596 	void
set(const char * field,std::vector<int> value)597 	set( const char *field, std::vector<int> value )
598 	{
599 		vips_image_set_array_int( this->get_image(), field, &value[0],
600 			static_cast<int>( value.size() ) );
601 	}
602 
603 	/**
604 	 * Set the value of an double array metadata item on an image.
605 	 *
606 	 * A copy of the array is taken.
607 	 */
608 	void
set(const char * field,double * value,int n)609 	set( const char *field, double *value, int n )
610 	{
611 		vips_image_set_array_double( this->get_image(), field, value, n );
612 	}
613 
614 	/**
615 	 * Set the value of an double array metadata item on an image.
616 	 *
617 	 * A copy of the array is taken.
618 	 */
619 	void
set(const char * field,std::vector<double> value)620 	set( const char *field, std::vector<double> value )
621 	{
622 		vips_image_set_array_double( this->get_image(), field, &value[0],
623 			static_cast<int>( value.size() ) );
624 	}
625 
626 	/**
627 	 * Set the value of a double metadata item on an image.
628 	 */
629 	void
set(const char * field,double value)630 	set( const char *field, double value )
631 	{
632 		vips_image_set_double( this->get_image(), field, value );
633 	}
634 
635 	/**
636 	 * Set the value of a string metadata item on an image.
637 	 *
638 	 * A copy of the string is taken.
639 	 */
640 	void
set(const char * field,const char * value)641 	set( const char *field, const char *value )
642 	{
643 		vips_image_set_string( this->get_image(), field, value );
644 	}
645 
646 	/**
647 	 * Set the value of a binary object metadata item on an image, such as
648 	 * an ICC profile.
649 	 *
650 	 * When libvips no longer needs the value, it will be disposed with
651 	 * the free function. This can be NULL.
652 	 */
653 	void
set(const char * field,VipsCallbackFn free_fn,void * data,size_t length)654 	set( const char *field,
655 		VipsCallbackFn free_fn, void *data, size_t length )
656 	{
657 		vips_image_set_blob( this->get_image(), field,
658 			free_fn, data, length );
659 	}
660 
661 	/**
662 	 * Return the GType of a metadata item, or 0 if the named item does not
663 	 * exist.
664 	 */
665 	GType
get_typeof(const char * field)666 	get_typeof( const char *field ) const
667 	{
668 		return( vips_image_get_typeof( this->get_image(), field ) );
669 	}
670 
671 	/**
672 	 * Get the value of a metadata item as an int.
673 	 *
674 	 * If the item is not of this type, an exception is thrown.
675 	 */
676 	int
get_int(const char * field)677 	get_int( const char *field ) const
678 	{
679 		int value;
680 
681 		if( vips_image_get_int( this->get_image(), field, &value ) )
682 			throw( VError() );
683 
684 		return( value );
685 	}
686 
687 	/**
688 	 * Get the value of a metadata item as an array of ints. Do not free
689 	 * the result.
690 	 *
691 	 * If the item is not of this type, an exception is thrown.
692 	 */
693 	void
get_array_int(const char * field,int ** out,int * n)694 	get_array_int( const char *field, int **out, int *n ) const
695 	{
696 		if( vips_image_get_array_int( this->get_image(),
697 			field, out, n ) )
698 			throw( VError() );
699 	}
700 
701 	/**
702 	 * Get the value of a metadata item as an array of ints.
703 	 *
704 	 * If the item is not of this type, an exception is thrown.
705 	 */
706 	std::vector<int>
get_array_int(const char * field)707 	get_array_int( const char *field ) const
708 	{
709 		int length;
710 		int *array;
711 
712 		if( vips_image_get_array_int( this->get_image(),
713 			field, &array, &length ) )
714 			throw( VError() );
715 
716 		std::vector<int> vector( array, array + length );
717 
718 		return( vector );
719 	}
720 
721 	/**
722 	 * Get the value of a metadata item as an array of doubles. Do not free
723 	 * the result.
724 	 *
725 	 * If the item is not of this type, an exception is thrown.
726 	 */
727 	void
get_array_double(const char * field,double ** out,int * n)728 	get_array_double( const char *field, double **out, int *n ) const
729 	{
730 		if( vips_image_get_array_double( this->get_image(),
731 			field, out, n ) )
732 			throw( VError() );
733 	}
734 
735 	/**
736 	 * Get the value of a metadata item as an array of doubles.
737 	 *
738 	 * If the item is not of this type, an exception is thrown.
739 	 */
740 	std::vector<double>
get_array_double(const char * field)741 	get_array_double( const char *field ) const
742 	{
743 		int length;
744 		double *array;
745 
746 		if( vips_image_get_array_double( this->get_image(),
747 			field, &array, &length ) )
748 			throw( VError() );
749 
750 		std::vector<double> vector( array, array + length );
751 
752 		return( vector );
753 	}
754 
755 	/**
756 	 * Get the value of a metadata item as a double.
757 	 *
758 	 * If the item is not of this type, an exception is thrown.
759 	 */
760 	double
get_double(const char * field)761 	get_double( const char *field ) const
762 	{
763 		double value;
764 
765 		if( vips_image_get_double( this->get_image(), field, &value ) )
766 			throw( VError() );
767 
768 		return( value );
769 	}
770 
771 	/**
772 	 * Get the value of a metadata item as a string. You must not free the
773 	 * result.
774 	 *
775 	 * If the item is not of this type, an exception is thrown.
776 	 */
777 	const char *
get_string(const char * field)778 	get_string( const char *field ) const
779 	{
780 		const char *value;
781 
782 		if( vips_image_get_string( this->get_image(), field, &value ) )
783 			throw( VError() );
784 
785 		return( value );
786 	}
787 
788 	/**
789 	 * Get the value of a metadata item as a binary object. You must not
790 	 * free the result.
791 	 *
792 	 * If the item is not of this type, an exception is thrown.
793 	 */
794 	const void *
get_blob(const char * field,size_t * length)795 	get_blob( const char *field, size_t *length ) const
796 	{
797 		const void *value;
798 
799 		if( vips_image_get_blob( this->get_image(), field,
800 			&value, length ) )
801 			throw( VError() );
802 
803 		return( value );
804 	}
805 
806 	/**
807 	 * Remove a metadata item. This does nothing if the item does not
808 	 * exist.
809 	 */
810 	bool
remove(const char * name)811 	remove( const char *name ) const
812 	{
813 		return( vips_image_remove( get_image(), name ) );
814 	}
815 
816 	/**
817 	 * Make a new VOption. Can save some typing.
818 	 */
819 	static VOption *
option()820 	option()
821 	{
822 		return( new VOption() );
823 	}
824 
825 	/**
826 	 * Call any libvips operation, with a set of string-encoded options as
827 	 * well as VOption.
828 	 */
829 	static void
830 	call_option_string( const char *operation_name,
831 		const char *option_string, VOption *options = 0 );
832 
833 	/**
834 	 * Call any libvips operation.
835 	 */
836 	static void
837 	call( const char *operation_name, VOption *options = 0 );
838 
839 	/**
840 	 * Make a new image which, when written to, will create a large memory
841 	 * object. See VImage::write().
842 	 */
843 	static VImage
new_memory()844 	new_memory()
845 	{
846 		return( VImage( vips_image_new_memory() ) );
847 	}
848 
849 	/**
850 	 * Make a new VImage which, when written to, will craete a temporary
851 	 * file on disc. See VImage::write().
852 	 */
853 	static VImage
854 	new_temp_file( const char *file_format = ".v" )
855 	{
856 		VipsImage *image;
857 
858 		if( !(image = vips_image_new_temp_file( file_format )) )
859 			throw( VError() );
860 
861 		return( VImage( image ) );
862 	}
863 
864 	/**
865 	 * Create a new VImage object from a file on disc.
866 	 *
867 	 * The available options depends on the image format. See for example
868 	 * VImage::jpegload().
869 	 */
870 	static VImage
871 	new_from_file( const char *name, VOption *options = 0 );
872 
873 	/**
874 	 * Create a new VImage object from an area of memory containing an
875 	 * image encoded in some format such as JPEG.
876 	 *
877 	 * The available options depends on the image format. See for example
878 	 * VImage::jpegload().
879 	 */
880 	static VImage
881 	new_from_buffer( const void *buf, size_t len,
882 		const char *option_string, VOption *options = 0 );
883 
884 	/**
885 	 * Create a new VImage object from an area of memory containing an
886 	 * image encoded in some format such as JPEG.
887 	 *
888 	 * The available options depends on the image format. See for example
889 	 * VImage::jpegload().
890 	 */
891 	static VImage
892 	new_from_buffer( const std::string &buf,
893 		const char *option_string, VOption *options = 0 );
894 
895 	/**
896 	 * Create a new VImage object from a generic source object.
897 	 *
898 	 * The available options depends on the image format. See for example
899 	 * VImage::jpegload().
900 	 */
901 	static VImage
902 	new_from_source( VSource source,
903 		const char *option_string, VOption *options = 0 );
904 
905 	/**
906 	 * Create a new VImage object from an area of memory containing a
907 	 * C-style array.
908 	 */
909 	static VImage
new_from_memory(void * data,size_t size,int width,int height,int bands,VipsBandFormat format)910 	new_from_memory( void *data, size_t size,
911 		int width, int height, int bands, VipsBandFormat format )
912 	{
913 		VipsImage *image;
914 
915 		if( !(image = vips_image_new_from_memory( data, size,
916 			width, height, bands, format )) )
917 			throw( VError() );
918 
919 		return( VImage( image ) );
920 	}
921 
922 	/**
923 	 * Create a new VImage object from an area of memory containing a
924 	 * C-style array.
925 	 *
926 	 * The VImage steals ownership of @data and will free() it when it
927 	 * goes out of scope.
928 	 */
929 	static VImage
930 	new_from_memory_steal( void *data, size_t size,
931 		int width, int height, int bands, VipsBandFormat format );
932 
933 	/**
934 	 * Create a matrix image of a specified size. All elements will be
935 	 * zero.
936 	 */
937 	static VImage
938 	new_matrix( int width, int height );
939 
940 	/**
941 	 * Create a matrix image of a specified size, initialized from the
942 	 * array.
943 	 */
944 	static VImage
new_matrix(int width,int height,double * array,int size)945 	new_matrix( int width, int height, double *array, int size )
946 	{
947 		VipsImage *image;
948 
949 		if( !(image = vips_image_new_matrix_from_array( width, height,
950 			array, size )) )
951 			throw( VError() );
952 
953 		return( VImage( image ) );
954 	}
955 
956 	/**
957 	 * Create a matrix image of a specified size, initialized from the
958 	 * function parameters.
959 	 */
960 	static VImage
961 	new_matrixv( int width, int height, ... );
962 
963 	/**
964 	 * Make a new image of the same size and type as self, but with each
965 	 * pixel initialized with the constant.
966 	 */
967 	VImage
new_from_image(std::vector<double> pixel)968 	new_from_image( std::vector<double> pixel ) const
969 	{
970 		VipsImage *image;
971 
972 		if( !(image = vips_image_new_from_image( this->get_image(),
973 			&pixel[0], static_cast<int>( pixel.size() ) )) )
974 			throw( VError() );
975 
976 		return( VImage( image ) );
977 	}
978 
979 	/**
980 	 * Make a new image of the same size and type as self, but with each
981 	 * pixel initialized with the constant.
982 	 */
983 	VImage
new_from_image(double pixel)984 	new_from_image( double pixel ) const
985 	{
986 		return( new_from_image( to_vectorv( 1, pixel ) ) );
987 	}
988 
989 	/**
990 	 * Make a new image by rendering self to a large memory area,
991 	 * wrapping a VImage around it, and copying all metadata over from
992 	 * self.
993 	 */
994 	VImage
copy_memory()995 	copy_memory() const
996 	{
997 		VipsImage *image;
998 
999 		if( !(image = vips_image_copy_memory( this->get_image() )) )
1000 			throw( VError() );
1001 
1002 		return( VImage( image ) );
1003 	}
1004 
1005 	/**
1006 	 * Write self to out. See VImage::new_memory() etc.
1007 	 */
1008 	VImage write( VImage out ) const;
1009 
1010 	/**
1011 	 * Write an image to a file.
1012 	 *
1013 	 * The available options depends on the file format. See
1014 	 * VImage::jpegsave(), for example.
1015 	 */
1016 	void write_to_file( const char *name, VOption *options = 0 ) const;
1017 
1018 	/**
1019 	 * Write an image to an area of memory in the specified format. You
1020 	 * must free() the memory area once you are done with it.
1021 	 *
1022 	 * For example:
1023 	 *
1024 	 *     void *buf;
1025 	 *     size_t size;
1026 	 *     image.write_to_buffer( ".jpg", &buf, &size );
1027 	 *
1028 	 * The available options depends on the file format. See
1029 	 * VImage::jpegsave(), for example.
1030 	 */
1031 	void write_to_buffer( const char *suffix, void **buf, size_t *size,
1032 		VOption *options = 0 ) const;
1033 
1034 	/**
1035 	 * Write an image to a generic target object in the specified format.
1036 	 *
1037 	 * The available options depends on the file format. See
1038 	 * VImage::jpegsave(), for example.
1039 	 */
1040 	void write_to_target( const char *suffix, VTarget target,
1041 		VOption *options = 0 ) const;
1042 
1043 	/**
1044 	 * Write an image to an area of memory as a C-style array.
1045 	 */
1046 	void *
write_to_memory(size_t * size)1047 	write_to_memory( size_t *size ) const
1048 	{
1049 		void *result;
1050 
1051 		if( !(result = vips_image_write_to_memory( this->get_image(),
1052 			size )) )
1053 			throw( VError() );
1054 
1055 		return( result );
1056 	}
1057 
1058 	/**
1059 	 * Apply a linear transform to an image. For every pixel,
1060 	 *
1061 	 *     out = in * a + b
1062 	 */
1063 	VImage
1064 	linear( double a, double b, VOption *options = 0 ) const
1065 	{
1066 		return( this->linear( to_vector( a ), to_vector( b ),
1067 			options ) );
1068 	}
1069 
1070 	/**
1071 	 * Apply a linear transform to an image. For every pixel,
1072 	 *
1073 	 *     out = in * a + b
1074 	 */
1075 	VImage
1076 	linear( std::vector<double> a, double b, VOption *options = 0 ) const
1077 	{
1078 		return( this->linear( a, to_vector( b ), options ) );
1079 	}
1080 
1081 	/**
1082 	 * Apply a linear transform to an image. For every pixel,
1083 	 *
1084 	 *     out = in * a + b
1085 	 */
1086 	VImage
1087 	linear( double a, std::vector<double> b, VOption *options = 0 ) const
1088 	{
1089 		return( this->linear( to_vector( a ), b, options ) );
1090 	}
1091 
1092 	/**
1093 	 * Split a many-band image into an array of one-band images.
1094 	 */
1095 	std::vector<VImage> bandsplit( VOption *options = 0 ) const;
1096 
1097 	/**
1098 	 * Join two images bandwise.
1099 	 */
1100 	VImage bandjoin( VImage other, VOption *options = 0 ) const;
1101 
1102 	/**
1103 	 * Append a band to an image, with each element initialized to the
1104 	 * constant value.
1105 	 */
1106 	VImage
1107 	bandjoin( double other, VOption *options = 0 ) const
1108 	{
1109 		return( bandjoin( to_vector( other ), options ) );
1110 	}
1111 
1112 	/**
1113 	 * Append a series of bands to an image, with each element initialized
1114 	 * to the constant values.
1115 	 */
1116 	VImage
1117 	bandjoin( std::vector<double> other, VOption *options = 0 ) const
1118 	{
1119 		return( bandjoin_const( other, options ) );
1120 	}
1121 
1122 	/**
1123 	 * Composite other on top of self using the specified blending mode.
1124 	 */
1125 	VImage composite( VImage other, VipsBlendMode mode,
1126 		VOption *options = 0 ) const;
1127 
1128 	/**
1129 	 * Find the position of the image minimum as (x, y).
1130 	 */
1131 	std::complex<double> minpos( VOption *options = 0 ) const;
1132 
1133 	/**
1134 	 * Find the position of the image maximum as (x, y).
1135 	 */
1136 	std::complex<double> maxpos( VOption *options = 0 ) const;
1137 
1138 	/**
1139 	 * Flip the image left-right.
1140 	 */
1141 	VImage
1142 	fliphor( VOption *options = 0 ) const
1143 	{
1144 		return( flip( VIPS_DIRECTION_HORIZONTAL, options ) );
1145 	}
1146 
1147 	/**
1148 	 * Flip the image top-bottom.
1149 	 */
1150 	VImage
1151 	flipver( VOption *options = 0 ) const
1152 	{
1153 		return( flip( VIPS_DIRECTION_VERTICAL, options ) );
1154 	}
1155 
1156 	/**
1157 	 * Rotate the image by 90 degrees clockwise.
1158 	 */
1159 	VImage
1160 	rot90( VOption *options = 0 ) const
1161 	{
1162 		return( rot( VIPS_ANGLE_D90, options ) );
1163 	}
1164 
1165 	/**
1166 	 * Rotate the image by 180 degrees.
1167 	 */
1168 	VImage
1169 	rot180( VOption *options = 0 ) const
1170 	{
1171 		return( rot( VIPS_ANGLE_D180, options ) );
1172 	}
1173 
1174 	/**
1175 	 * Rotate the image by 270 degrees clockwise.
1176 	 */
1177 	VImage
1178 	rot270( VOption *options = 0 ) const
1179 	{
1180 		return( rot( VIPS_ANGLE_D270, options ) );
1181 	}
1182 
1183 	/**
1184 	 * Dilate the image with the specified strucuring element, see
1185 	 * VImage::new_matrix(). Stucturing element values can be 0 for
1186 	 * black, 255 for white and 128 for don't care. See VImage::morph().
1187 	 */
1188 	VImage
1189 	dilate( VImage mask, VOption *options = 0 ) const
1190 	{
1191 		return( morph( mask, VIPS_OPERATION_MORPHOLOGY_DILATE,
1192 			options ) );
1193 	}
1194 
1195 	/**
1196 	 * Erode the image with the specified strucuring element, see
1197 	 * VImage::new_matrix(). Stucturing element values can be 0 for
1198 	 * black, 255 for white and 128 for don't care. See VImage::morph().
1199 	 */
1200 	VImage
1201 	erode( VImage mask, VOption *options = 0 ) const
1202 	{
1203 		return( morph( mask, VIPS_OPERATION_MORPHOLOGY_ERODE,
1204 			options ) );
1205 	}
1206 
1207 	/**
1208 	 * A median filter of the specified size. See VImage::rank().
1209 	 */
1210 	VImage
1211 	median( int size = 3, VOption *options = 0 ) const
1212 	{
1213 		return( rank( size, size, (size * size) / 2, options ) );
1214 	}
1215 
1216 	/**
1217 	 * Convert to integer, rounding down.
1218 	 */
1219 	VImage
1220 	floor( VOption *options = 0 ) const
1221 	{
1222 		return( round( VIPS_OPERATION_ROUND_FLOOR, options ) );
1223 	}
1224 
1225 	/**
1226 	 * Convert to integer, rounding up.
1227 	 */
1228 	VImage
1229 	ceil( VOption *options = 0 ) const
1230 	{
1231 		return( round( VIPS_OPERATION_ROUND_CEIL, options ) );
1232 	}
1233 
1234 	/**
1235 	 * Convert to integer, rounding to nearest.
1236 	 */
1237 	VImage
1238 	rint( VOption *options = 0 ) const
1239 	{
1240 		return( round( VIPS_OPERATION_ROUND_RINT, options ) );
1241 	}
1242 
1243 	/**
1244 	 * AND all bands of an image together to make a one-band image. Useful
1245 	 * with the relational operators, for example:
1246 	 *
1247 	 *     VImage mask = (in > 128).bandand()
1248 	 */
1249 	VImage
1250 	bandand( VOption *options = 0 ) const
1251 	{
1252 		return( bandbool( VIPS_OPERATION_BOOLEAN_AND, options ) );
1253 	}
1254 
1255 	/**
1256 	 * OR all bands of an image together to make a one-band image. Useful
1257 	 * with the relational operators, for example:
1258 	 *
1259 	 *     VImage mask = (in > 128).bandand()
1260 	 */
1261 	VImage
1262 	bandor( VOption *options = 0 ) const
1263 	{
1264 		return( bandbool( VIPS_OPERATION_BOOLEAN_OR, options ) );
1265 	}
1266 
1267 	/**
1268 	 * EOR all bands of an image together to make a one-band image. Useful
1269 	 * with the relational operators, for example:
1270 	 *
1271 	 *     VImage mask = (in > 128).bandand()
1272 	 */
1273 	VImage
1274 	bandeor( VOption *options = 0 ) const
1275 	{
1276 		return( bandbool( VIPS_OPERATION_BOOLEAN_EOR, options ) );
1277 	}
1278 
1279 	/**
1280 	 * Return the real part of a complex image.
1281 	 */
1282 	VImage
1283 	real( VOption *options = 0 ) const
1284 	{
1285 		return( complexget( VIPS_OPERATION_COMPLEXGET_REAL, options ) );
1286 	}
1287 
1288 	/**
1289 	 * Return the imaginary part of a complex image.
1290 	 */
1291 	VImage
1292 	imag( VOption *options = 0 ) const
1293 	{
1294 		return( complexget( VIPS_OPERATION_COMPLEXGET_IMAG, options ) );
1295 	}
1296 
1297 	/**
1298 	 * Convert a complex image to polar coordinates.
1299 	 */
1300 	VImage
1301 	polar( VOption *options = 0 ) const
1302 	{
1303 		return( complex( VIPS_OPERATION_COMPLEX_POLAR, options ) );
1304 	}
1305 
1306 	/**
1307 	 * Convert a complex image to rectangular coordinates.
1308 	 */
1309 	VImage
1310 	rect( VOption *options = 0 ) const
1311 	{
1312 		return( complex( VIPS_OPERATION_COMPLEX_RECT, options ) );
1313 	}
1314 
1315 	/**
1316 	 * Find the complex conjugate.
1317 	 */
1318 	VImage
1319 	conj( VOption *options = 0 ) const
1320 	{
1321 		return( complex( VIPS_OPERATION_COMPLEX_CONJ, options ) );
1322 	}
1323 
1324 	/**
1325 	 * Find the sine of each pixel. Angles are in degrees.
1326 	 */
1327 	VImage
1328 	sin( VOption *options = 0 ) const
1329 	{
1330 		return( math( VIPS_OPERATION_MATH_SIN, options ) );
1331 	}
1332 
1333 	/**
1334 	 * Find the cosine of each pixel. Angles are in degrees.
1335 	 */
1336 	VImage
1337 	cos( VOption *options = 0 ) const
1338 	{
1339 		return( math( VIPS_OPERATION_MATH_COS, options ) );
1340 	}
1341 
1342 	/**
1343 	 * Find the tangent of each pixel. Angles are in degrees.
1344 	 */
1345 	VImage
1346 	tan( VOption *options = 0 ) const
1347 	{
1348 		return( math( VIPS_OPERATION_MATH_TAN, options ) );
1349 	}
1350 
1351 	/**
1352 	 * Find the arc sine of each pixel. Angles are in degrees.
1353 	 */
1354 	VImage
1355 	asin( VOption *options = 0 ) const
1356 	{
1357 		return( math( VIPS_OPERATION_MATH_ASIN, options ) );
1358 	}
1359 
1360 	/**
1361 	 * Find the arc cosine of each pixel. Angles are in degrees.
1362 	 */
1363 	VImage
1364 	acos( VOption *options = 0 ) const
1365 	{
1366 		return( math( VIPS_OPERATION_MATH_ACOS, options ) );
1367 	}
1368 
1369 	/**
1370 	 * Find the arc tangent of each pixel. Angles are in degrees.
1371 	 */
1372 	VImage
1373 	atan( VOption *options = 0 ) const
1374 	{
1375 		return( math( VIPS_OPERATION_MATH_ATAN, options ) );
1376 	}
1377 
1378 	/**
1379 	 * Find the hyperbolic sine of each pixel. Angles are in degrees.
1380 	 */
1381 	VImage
1382 	sinh( VOption *options = 0 ) const
1383 	{
1384 		return( math( VIPS_OPERATION_MATH_SINH, options ) );
1385 	}
1386 
1387 	/**
1388 	 * Find the hyperbolic cosine of each pixel. Angles are in degrees.
1389 	 */
1390 	VImage
1391 	cosh( VOption *options = 0 ) const
1392 	{
1393 		return( math( VIPS_OPERATION_MATH_COSH, options ) );
1394 	}
1395 
1396 	/**
1397 	 * Find the hyperbolic tangent of each pixel. Angles are in degrees.
1398 	 */
1399 	VImage
1400 	tanh( VOption *options = 0 ) const
1401 	{
1402 		return( math( VIPS_OPERATION_MATH_TANH, options ) );
1403 	}
1404 
1405 	/**
1406 	 * Find the hyperbolic arc sine of each pixel. Angles are in radians.
1407 	 */
1408 	VImage
1409 	asinh( VOption *options = 0 ) const
1410 	{
1411 		return( math( VIPS_OPERATION_MATH_ASINH, options ) );
1412 	}
1413 
1414 	/**
1415 	 * Find the hyperbolic arc cosine of each pixel. Angles are in radians.
1416 	 */
1417 	VImage
1418 	acosh( VOption *options = 0 ) const
1419 	{
1420 		return( math( VIPS_OPERATION_MATH_ACOSH, options ) );
1421 	}
1422 
1423 	/**
1424 	 * Find the hyperbolic arc tangent of each pixel. Angles are in radians.
1425 	 */
1426 	VImage
1427 	atanh( VOption *options = 0 ) const
1428 	{
1429 		return( math( VIPS_OPERATION_MATH_ATANH, options ) );
1430 	}
1431 
1432 	/**
1433 	 * Find the natural log of each pixel.
1434 	 */
1435 	VImage
1436 	log( VOption *options = 0 ) const
1437 	{
1438 		return( math( VIPS_OPERATION_MATH_LOG, options ) );
1439 	}
1440 
1441 	/**
1442 	 * Find the base 10 log of each pixel.
1443 	 */
1444 	VImage
1445 	log10( VOption *options = 0 ) const
1446 	{
1447 		return( math( VIPS_OPERATION_MATH_LOG10, options ) );
1448 	}
1449 
1450 	/**
1451 	 * Find e to the power of each pixel.
1452 	 */
1453 	VImage
1454 	exp( VOption *options = 0 ) const
1455 	{
1456 		return( math( VIPS_OPERATION_MATH_EXP, options ) );
1457 	}
1458 
1459 	/**
1460 	 * Find 10 to the power of each pixel.
1461 	 */
1462 	VImage
1463 	exp10( VOption *options = 0 ) const
1464 	{
1465 		return( math( VIPS_OPERATION_MATH_EXP10, options ) );
1466 	}
1467 
1468 	/**
1469 	 * Raise each pixel to the specified power.
1470 	 */
1471 	VImage
1472 	pow( VImage other, VOption *options = 0 ) const
1473 	{
1474 		return( math2( other, VIPS_OPERATION_MATH2_POW, options ) );
1475 	}
1476 
1477 	/**
1478 	 * Raise each pixel to the specified power.
1479 	 */
1480 	VImage
1481 	pow( double other, VOption *options = 0 ) const
1482 	{
1483 		return( math2_const( VIPS_OPERATION_MATH2_POW,
1484 			to_vector( other ), options ) );
1485 	}
1486 
1487 	/**
1488 	 * Raise each pixel to the specified power.
1489 	 */
1490 	VImage
1491 	pow( std::vector<double> other, VOption *options = 0 ) const
1492 	{
1493 		return( math2_const( VIPS_OPERATION_MATH2_POW,
1494 			other, options ) );
1495 	}
1496 
1497 	/**
1498 	 * Raise other to the power of each pixel (the opposite of pow).
1499 	 */
1500 	VImage
1501 	wop( VImage other, VOption *options = 0 ) const
1502 	{
1503 		return( math2( other, VIPS_OPERATION_MATH2_WOP, options ) );
1504 	}
1505 
1506 	/**
1507 	 * Raise the constant to the power of each pixel (the opposite of pow).
1508 	 */
1509 	VImage
1510 	wop( double other, VOption *options = 0 ) const
1511 	{
1512 		return( math2_const( VIPS_OPERATION_MATH2_WOP,
1513 			to_vector( other ), options ) );
1514 	}
1515 
1516 	/**
1517 	 * Raise the constant to the power of each pixel (the opposite of pow).
1518 	 */
1519 	VImage
1520 	wop( std::vector<double> other, VOption *options = 0 ) const
1521 	{
1522 		return( math2_const( VIPS_OPERATION_MATH2_WOP,
1523 			other, options ) );
1524 	}
1525 
1526 	/**
1527 	 * Calculate atan2 of each pixel.
1528 	 */
1529 	VImage
1530 	atan2( VImage other, VOption *options = 0 ) const
1531 	{
1532 		return( math2( other, VIPS_OPERATION_MATH2_ATAN2, options ) );
1533 	}
1534 
1535 	/**
1536 	 * Calculate atan2 of each pixel.
1537 	 */
1538 	VImage
1539 	atan2( double other, VOption *options = 0 ) const
1540 	{
1541 		return( math2_const( VIPS_OPERATION_MATH2_ATAN2,
1542 			to_vector( other ), options ) );
1543 	}
1544 
1545 	/**
1546 	 * Calculate atan2 of each pixel.
1547 	 */
1548 	VImage
1549 	atan2( std::vector<double> other, VOption *options = 0 ) const
1550 	{
1551 		return( math2_const( VIPS_OPERATION_MATH2_ATAN2,
1552 			other, options ) );
1553 	}
1554 
1555 	/**
1556 	 * Use self as a conditional image (not zero meaning TRUE) to pick
1557 	 * pixels from th (then) or el (else).
1558 	 */
1559 	VImage
1560 	ifthenelse( std::vector<double> th, VImage el,
1561 		VOption *options = 0 ) const
1562 	{
1563 		return( ifthenelse( el.new_from_image( th ), el, options ) );
1564 	}
1565 
1566 	/**
1567 	 * Use self as a conditional image (not zero meaning TRUE) to pick
1568 	 * pixels from th (then) or el (else).
1569 	 */
1570 	VImage
1571 	ifthenelse( VImage th, std::vector<double> el,
1572 		VOption *options = 0 ) const
1573 	{
1574 		return( ifthenelse( th, th.new_from_image( el ), options ) );
1575 	}
1576 
1577 	/**
1578 	 * Use self as a conditional image (not zero meaning TRUE) to pick
1579 	 * pixels from th (then) or el (else).
1580 	 */
1581 	VImage
1582 	ifthenelse( std::vector<double> th, std::vector<double> el,
1583 		VOption *options = 0 ) const
1584 	{
1585 		return( ifthenelse( new_from_image( th ), new_from_image( el ),
1586 			options ) );
1587 	}
1588 
1589 	/**
1590 	 * Use self as a conditional image (not zero meaning TRUE) to pick
1591 	 * pixels from th (then) or el (else).
1592 	 */
1593 	VImage
1594 	ifthenelse( double th, VImage el, VOption *options = 0 ) const
1595 	{
1596 		return( ifthenelse( to_vector( th ), el, options ) );
1597 	}
1598 
1599 	/**
1600 	 * Use self as a conditional image (not zero meaning TRUE) to pick
1601 	 * pixels from th (then) or el (else).
1602 	 */
1603 	VImage
1604 	ifthenelse( VImage th, double el, VOption *options = 0 ) const
1605 	{
1606 		return( ifthenelse( th, to_vector( el ), options ) );
1607 	}
1608 
1609 	/**
1610 	 * Use self as a conditional image (not zero meaning TRUE) to pick
1611 	 * pixels from th (then) or el (else).
1612 	 */
1613 	VImage
1614 	ifthenelse( double th, double el, VOption *options = 0 ) const
1615 	{
1616 		return( ifthenelse( to_vector( th ), to_vector( el ),
1617 			options ) );
1618 	}
1619 
1620 	// Operator overloads
1621 
1622 	VImage operator[]( int index ) const;
1623 
1624 	std::vector<double> operator()( int x, int y ) const;
1625 
1626 	friend VIPS_CPLUSPLUS_API VImage
1627 		operator+( const VImage a, const VImage b );
1628 	friend VIPS_CPLUSPLUS_API VImage
1629 		operator+( const double a, const VImage b );
1630 	friend VIPS_CPLUSPLUS_API VImage
1631 		operator+( const VImage a, const double b );
1632 	friend VIPS_CPLUSPLUS_API VImage
1633 		operator+( const std::vector<double> a, const VImage b );
1634 	friend VIPS_CPLUSPLUS_API VImage
1635 		operator+( const VImage a, const std::vector<double> b );
1636 
1637 	friend VIPS_CPLUSPLUS_API VImage &
1638 		operator+=( VImage &a, const VImage b );
1639 	friend VIPS_CPLUSPLUS_API VImage &
1640 		operator+=( VImage &a, const double b );
1641 	friend VIPS_CPLUSPLUS_API VImage &
1642 		operator+=( VImage &a, const std::vector<double> b );
1643 
1644 	friend VIPS_CPLUSPLUS_API VImage
1645 		operator-( const VImage a, const VImage b );
1646 	friend VIPS_CPLUSPLUS_API VImage
1647 		operator-( const double a, const VImage b );
1648 	friend VIPS_CPLUSPLUS_API VImage
1649 		operator-( const VImage a, const double b );
1650 	friend VIPS_CPLUSPLUS_API VImage
1651 		operator-( const std::vector<double> a, const VImage b );
1652 	friend VIPS_CPLUSPLUS_API VImage
1653 		operator-( const VImage a, const std::vector<double> b );
1654 
1655 	friend VIPS_CPLUSPLUS_API VImage &
1656 		operator-=( VImage &a, const VImage b );
1657 	friend VIPS_CPLUSPLUS_API VImage &
1658 		operator-=( VImage &a, const double b );
1659 	friend VIPS_CPLUSPLUS_API VImage &
1660 		operator-=( VImage &a, const std::vector<double> b );
1661 
1662 	friend VIPS_CPLUSPLUS_API VImage
1663 		operator-( const VImage a );
1664 
1665 	friend VIPS_CPLUSPLUS_API VImage
1666 		operator*( const VImage a, const VImage b );
1667 	friend VIPS_CPLUSPLUS_API VImage
1668 		operator*( const double a, const VImage b );
1669 	friend VIPS_CPLUSPLUS_API VImage
1670 		operator*( const VImage a, const double b );
1671 	friend VIPS_CPLUSPLUS_API VImage
1672 		operator*( const std::vector<double> a, const VImage b );
1673 	friend VIPS_CPLUSPLUS_API VImage
1674 		operator*( const VImage a, const std::vector<double> b );
1675 
1676 	friend VIPS_CPLUSPLUS_API VImage &
1677 		operator*=( VImage &a, const VImage b );
1678 	friend VIPS_CPLUSPLUS_API VImage &
1679 		operator*=( VImage &a, const double b );
1680 	friend VIPS_CPLUSPLUS_API VImage &
1681 		operator*=( VImage &a, const std::vector<double> b );
1682 
1683 	friend VIPS_CPLUSPLUS_API VImage
1684 		operator/( const VImage a, const VImage b );
1685 	friend VIPS_CPLUSPLUS_API VImage
1686 		operator/( const double a, const VImage b );
1687 	friend VIPS_CPLUSPLUS_API VImage
1688 		operator/( const VImage a, const double b );
1689 	friend VIPS_CPLUSPLUS_API VImage
1690 		operator/( const std::vector<double> a, const VImage b );
1691 	friend VIPS_CPLUSPLUS_API VImage
1692 		operator/( const VImage a, const std::vector<double> b );
1693 
1694 	friend VIPS_CPLUSPLUS_API VImage &
1695 		operator/=( VImage &a, const VImage b );
1696 	friend VIPS_CPLUSPLUS_API VImage &
1697 		operator/=( VImage &a, const double b );
1698 	friend VIPS_CPLUSPLUS_API VImage &
1699 		operator/=( VImage &a, const std::vector<double> b );
1700 
1701 	friend VIPS_CPLUSPLUS_API VImage
1702 		operator%( const VImage a, const VImage b );
1703 	friend VIPS_CPLUSPLUS_API VImage
1704 		operator%( const VImage a, const double b );
1705 	friend VIPS_CPLUSPLUS_API VImage
1706 		operator%( const VImage a, const std::vector<double> b );
1707 
1708 	friend VIPS_CPLUSPLUS_API VImage &
1709 		operator%=( VImage &a, const VImage b );
1710 	friend VIPS_CPLUSPLUS_API VImage &
1711 		operator%=( VImage &a, const double b );
1712 	friend VIPS_CPLUSPLUS_API VImage &
1713 		operator%=( VImage &a, const std::vector<double> b );
1714 
1715 	friend VIPS_CPLUSPLUS_API VImage
1716 		operator<( const VImage a, const VImage b );
1717 	friend VIPS_CPLUSPLUS_API VImage
1718 		operator<( const double a, const VImage b );
1719 	friend VIPS_CPLUSPLUS_API VImage
1720 		operator<( const VImage a, const double b );
1721 	friend VIPS_CPLUSPLUS_API VImage
1722 		operator<( const std::vector<double> a, const VImage b );
1723 	friend VIPS_CPLUSPLUS_API VImage
1724 		operator<( const VImage a, const std::vector<double> b );
1725 
1726 	friend VIPS_CPLUSPLUS_API VImage
1727 		operator<=( const VImage a, const VImage b );
1728 	friend VIPS_CPLUSPLUS_API VImage
1729 		operator<=( const double a, const VImage b );
1730 	friend VIPS_CPLUSPLUS_API VImage
1731 		operator<=( const VImage a, const double b );
1732 	friend VIPS_CPLUSPLUS_API VImage
1733 		operator<=( const std::vector<double> a, const VImage b );
1734 	friend VIPS_CPLUSPLUS_API VImage
1735 		operator<=( const VImage a, const std::vector<double> b );
1736 
1737 	friend VIPS_CPLUSPLUS_API VImage
1738 		operator>( const VImage a, const VImage b );
1739 	friend VIPS_CPLUSPLUS_API VImage
1740 		operator>( const double a, const VImage b );
1741 	friend VIPS_CPLUSPLUS_API VImage
1742 		operator>( const VImage a, const double b );
1743 	friend VIPS_CPLUSPLUS_API VImage
1744 		operator>( const std::vector<double> a, const VImage b );
1745 	friend VIPS_CPLUSPLUS_API VImage
1746 		operator>( const VImage a, const std::vector<double> b );
1747 
1748 	friend VIPS_CPLUSPLUS_API VImage
1749 		operator>=( const VImage a, const VImage b );
1750 	friend VIPS_CPLUSPLUS_API VImage
1751 		operator>=( const double a, const VImage b );
1752 	friend VIPS_CPLUSPLUS_API VImage
1753 		operator>=( const VImage a, const double b );
1754 	friend VIPS_CPLUSPLUS_API VImage
1755 		operator>=( const std::vector<double> a, const VImage b );
1756 	friend VIPS_CPLUSPLUS_API VImage
1757 		operator>=( const VImage a, const std::vector<double> b );
1758 
1759 	friend VIPS_CPLUSPLUS_API VImage
1760 		operator==( const VImage a, const VImage b );
1761 	friend VIPS_CPLUSPLUS_API VImage
1762 		operator==( const double a, const VImage b );
1763 	friend VIPS_CPLUSPLUS_API VImage
1764 		operator==( const VImage a, const double b );
1765 	friend VIPS_CPLUSPLUS_API VImage
1766 		operator==( const std::vector<double> a, const VImage b );
1767 	friend VIPS_CPLUSPLUS_API VImage
1768 		operator==( const VImage a, const std::vector<double> b );
1769 
1770 	friend VIPS_CPLUSPLUS_API VImage
1771 		operator!=( const VImage a, const VImage b );
1772 	friend VIPS_CPLUSPLUS_API VImage
1773 		operator!=( const double a, const VImage b );
1774 	friend VIPS_CPLUSPLUS_API VImage
1775 		operator!=( const VImage a, const double b );
1776 	friend VIPS_CPLUSPLUS_API VImage
1777 		operator!=( const std::vector<double> a, const VImage b );
1778 	friend VIPS_CPLUSPLUS_API VImage
1779 		operator!=( const VImage a, const std::vector<double> b );
1780 
1781 	friend VIPS_CPLUSPLUS_API VImage
1782 		operator&( const VImage a, const VImage b );
1783 	friend VIPS_CPLUSPLUS_API VImage
1784 		operator&( const double a, const VImage b );
1785 	friend VIPS_CPLUSPLUS_API VImage
1786 		operator&( const VImage a, const double b );
1787 	friend VIPS_CPLUSPLUS_API VImage
1788 		operator&( const std::vector<double> a, const VImage b );
1789 	friend VIPS_CPLUSPLUS_API VImage
1790 		operator&( const VImage a, const std::vector<double> b );
1791 
1792 	friend VIPS_CPLUSPLUS_API VImage &
1793 		operator&=( VImage &a, const VImage b );
1794 	friend VIPS_CPLUSPLUS_API VImage &
1795 		operator&=( VImage &a, const double b );
1796 	friend VIPS_CPLUSPLUS_API VImage &
1797 		operator&=( VImage &a, const std::vector<double> b );
1798 
1799 	friend VIPS_CPLUSPLUS_API VImage
1800 		operator|( const VImage a, const VImage b );
1801 	friend VIPS_CPLUSPLUS_API VImage
1802 		operator|( const double a, const VImage b );
1803 	friend VIPS_CPLUSPLUS_API VImage
1804 		operator|( const VImage a, const double b );
1805 	friend VIPS_CPLUSPLUS_API VImage
1806 		operator|( const std::vector<double> a, const VImage b );
1807 	friend VIPS_CPLUSPLUS_API VImage
1808 		operator|( const VImage a, const std::vector<double> b );
1809 
1810 	friend VIPS_CPLUSPLUS_API VImage &
1811 		operator|=( VImage &a, const VImage b );
1812 	friend VIPS_CPLUSPLUS_API VImage &
1813 		operator|=( VImage &a, const double b );
1814 	friend VIPS_CPLUSPLUS_API VImage &
1815 		operator|=( VImage &a, const std::vector<double> b );
1816 
1817 	friend VIPS_CPLUSPLUS_API VImage
1818 		operator^( const VImage a, const VImage b );
1819 	friend VIPS_CPLUSPLUS_API VImage
1820 		operator^( const double a, const VImage b );
1821 	friend VIPS_CPLUSPLUS_API VImage
1822 		operator^( const VImage a, const double b );
1823 	friend VIPS_CPLUSPLUS_API VImage
1824 		operator^( const std::vector<double> a, const VImage b );
1825 	friend VIPS_CPLUSPLUS_API VImage
1826 		operator^( const VImage a, const std::vector<double> b );
1827 
1828 	friend VIPS_CPLUSPLUS_API VImage &
1829 		operator^=( VImage &a, const VImage b );
1830 	friend VIPS_CPLUSPLUS_API VImage &
1831 		operator^=( VImage &a, const double b );
1832 	friend VIPS_CPLUSPLUS_API VImage &
1833 		operator^=( VImage &a, const std::vector<double> b );
1834 
1835 	friend VIPS_CPLUSPLUS_API VImage
1836 		operator<<( const VImage a, const VImage b );
1837 	friend VIPS_CPLUSPLUS_API VImage
1838 		operator<<( const VImage a, const double b );
1839 	friend VIPS_CPLUSPLUS_API VImage
1840 		operator<<( const VImage a, const std::vector<double> b );
1841 
1842 	friend VIPS_CPLUSPLUS_API VImage &
1843 		operator<<=( VImage &a, const VImage b );
1844 	friend VIPS_CPLUSPLUS_API VImage &
1845 		operator<<=( VImage &a, const double b );
1846 	friend VIPS_CPLUSPLUS_API VImage &
1847 		operator<<=( VImage &a, const std::vector<double> b );
1848 
1849 	friend VIPS_CPLUSPLUS_API VImage
1850 		operator>>( const VImage a, const VImage b );
1851 	friend VIPS_CPLUSPLUS_API VImage
1852 		operator>>( const VImage a, const double b );
1853 	friend VIPS_CPLUSPLUS_API VImage
1854 		operator>>( const VImage a, const std::vector<double> b );
1855 
1856 	friend VIPS_CPLUSPLUS_API VImage &
1857 		operator>>=( VImage &a, const VImage b );
1858 	friend VIPS_CPLUSPLUS_API VImage &
1859 		operator>>=( VImage &a, const double b );
1860 	friend VIPS_CPLUSPLUS_API VImage &
1861 		operator>>=( VImage &a, const std::vector<double> b );
1862 
1863 	/* Automatically generated members.
1864 	 *
1865 	 * Rebuild with:
1866 	 *
1867 	 * 	make vips-operators
1868 	 *
1869 	 * Then delete from here to the end of the class and paste in
1870 	 * vips-operators.h. We could just #include vips-operators.h, but
1871 	 * that confuses doxygen.
1872 	 */
1873 
1874 // headers for vips operations
1875 // Mon Nov  1 03:31:09 PM CET 2021
1876 // this file is generated automatically, do not edit!
1877 
1878 /**
1879  * Transform lch to cmc.
1880  * @param options Set of options.
1881  * @return Output image.
1882  */
1883 VImage CMC2LCh( VOption *options = 0 ) const;
1884 
1885 /**
1886  * Transform cmyk to xyz.
1887  * @param options Set of options.
1888  * @return Output image.
1889  */
1890 VImage CMYK2XYZ( VOption *options = 0 ) const;
1891 
1892 /**
1893  * Transform hsv to srgb.
1894  * @param options Set of options.
1895  * @return Output image.
1896  */
1897 VImage HSV2sRGB( VOption *options = 0 ) const;
1898 
1899 /**
1900  * Transform lch to cmc.
1901  * @param options Set of options.
1902  * @return Output image.
1903  */
1904 VImage LCh2CMC( VOption *options = 0 ) const;
1905 
1906 /**
1907  * Transform lch to lab.
1908  * @param options Set of options.
1909  * @return Output image.
1910  */
1911 VImage LCh2Lab( VOption *options = 0 ) const;
1912 
1913 /**
1914  * Transform lab to lch.
1915  * @param options Set of options.
1916  * @return Output image.
1917  */
1918 VImage Lab2LCh( VOption *options = 0 ) const;
1919 
1920 /**
1921  * Transform float lab to labq coding.
1922  * @param options Set of options.
1923  * @return Output image.
1924  */
1925 VImage Lab2LabQ( VOption *options = 0 ) const;
1926 
1927 /**
1928  * Transform float lab to signed short.
1929  * @param options Set of options.
1930  * @return Output image.
1931  */
1932 VImage Lab2LabS( VOption *options = 0 ) const;
1933 
1934 /**
1935  * Transform cielab to xyz.
1936  *
1937  * **Optional parameters**
1938  *   - **temp** -- Color temperature, std::vector<double>.
1939  *
1940  * @param options Set of options.
1941  * @return Output image.
1942  */
1943 VImage Lab2XYZ( VOption *options = 0 ) const;
1944 
1945 /**
1946  * Unpack a labq image to float lab.
1947  * @param options Set of options.
1948  * @return Output image.
1949  */
1950 VImage LabQ2Lab( VOption *options = 0 ) const;
1951 
1952 /**
1953  * Unpack a labq image to short lab.
1954  * @param options Set of options.
1955  * @return Output image.
1956  */
1957 VImage LabQ2LabS( VOption *options = 0 ) const;
1958 
1959 /**
1960  * Convert a labq image to srgb.
1961  * @param options Set of options.
1962  * @return Output image.
1963  */
1964 VImage LabQ2sRGB( VOption *options = 0 ) const;
1965 
1966 /**
1967  * Transform signed short lab to float.
1968  * @param options Set of options.
1969  * @return Output image.
1970  */
1971 VImage LabS2Lab( VOption *options = 0 ) const;
1972 
1973 /**
1974  * Transform short lab to labq coding.
1975  * @param options Set of options.
1976  * @return Output image.
1977  */
1978 VImage LabS2LabQ( VOption *options = 0 ) const;
1979 
1980 /**
1981  * Transform xyz to cmyk.
1982  * @param options Set of options.
1983  * @return Output image.
1984  */
1985 VImage XYZ2CMYK( VOption *options = 0 ) const;
1986 
1987 /**
1988  * Transform xyz to lab.
1989  *
1990  * **Optional parameters**
1991  *   - **temp** -- Colour temperature, std::vector<double>.
1992  *
1993  * @param options Set of options.
1994  * @return Output image.
1995  */
1996 VImage XYZ2Lab( VOption *options = 0 ) const;
1997 
1998 /**
1999  * Transform xyz to yxy.
2000  * @param options Set of options.
2001  * @return Output image.
2002  */
2003 VImage XYZ2Yxy( VOption *options = 0 ) const;
2004 
2005 /**
2006  * Transform xyz to scrgb.
2007  * @param options Set of options.
2008  * @return Output image.
2009  */
2010 VImage XYZ2scRGB( VOption *options = 0 ) const;
2011 
2012 /**
2013  * Transform yxy to xyz.
2014  * @param options Set of options.
2015  * @return Output image.
2016  */
2017 VImage Yxy2XYZ( VOption *options = 0 ) const;
2018 
2019 /**
2020  * Absolute value of an image.
2021  * @param options Set of options.
2022  * @return Output image.
2023  */
2024 VImage abs( VOption *options = 0 ) const;
2025 
2026 /**
2027  * Add two images.
2028  * @param right Right-hand image argument.
2029  * @param options Set of options.
2030  * @return Output image.
2031  */
2032 VImage add( VImage right, VOption *options = 0 ) const;
2033 
2034 /**
2035  * Affine transform of an image.
2036  *
2037  * **Optional parameters**
2038  *   - **interpolate** -- Interpolate pixels with this, VInterpolate.
2039  *   - **oarea** -- Area of output to generate, std::vector<int>.
2040  *   - **odx** -- Horizontal output displacement, double.
2041  *   - **ody** -- Vertical output displacement, double.
2042  *   - **idx** -- Horizontal input displacement, double.
2043  *   - **idy** -- Vertical input displacement, double.
2044  *   - **background** -- Background value, std::vector<double>.
2045  *   - **premultiplied** -- Images have premultiplied alpha, bool.
2046  *   - **extend** -- How to generate the extra pixels, VipsExtend.
2047  *
2048  * @param matrix Transformation matrix.
2049  * @param options Set of options.
2050  * @return Output image.
2051  */
2052 VImage affine( std::vector<double> matrix, VOption *options = 0 ) const;
2053 
2054 /**
2055  * Load an analyze6 image.
2056  *
2057  * **Optional parameters**
2058  *   - **memory** -- Force open via memory, bool.
2059  *   - **access** -- Required access pattern for this file, VipsAccess.
2060  *   - **fail_on** -- Error level to fail on, VipsFailOn.
2061  *
2062  * @param filename Filename to load from.
2063  * @param options Set of options.
2064  * @return Output image.
2065  */
2066 static VImage analyzeload( const char *filename, VOption *options = 0 );
2067 
2068 /**
2069  * Join an array of images.
2070  *
2071  * **Optional parameters**
2072  *   - **across** -- Number of images across grid, int.
2073  *   - **shim** -- Pixels between images, int.
2074  *   - **background** -- Colour for new pixels, std::vector<double>.
2075  *   - **halign** -- Align on the left, centre or right, VipsAlign.
2076  *   - **valign** -- Align on the top, centre or bottom, VipsAlign.
2077  *   - **hspacing** -- Horizontal spacing between images, int.
2078  *   - **vspacing** -- Vertical spacing between images, int.
2079  *
2080  * @param in Array of input images.
2081  * @param options Set of options.
2082  * @return Output image.
2083  */
2084 static VImage arrayjoin( std::vector<VImage> in, VOption *options = 0 );
2085 
2086 /**
2087  * Autorotate image by exif tag.
2088  * @param options Set of options.
2089  * @return Output image.
2090  */
2091 VImage autorot( VOption *options = 0 ) const;
2092 
2093 /**
2094  * Find image average.
2095  * @param options Set of options.
2096  * @return Output value.
2097  */
2098 double avg( VOption *options = 0 ) const;
2099 
2100 /**
2101  * Boolean operation across image bands.
2102  * @param boolean boolean to perform.
2103  * @param options Set of options.
2104  * @return Output image.
2105  */
2106 VImage bandbool( VipsOperationBoolean boolean, VOption *options = 0 ) const;
2107 
2108 /**
2109  * Fold up x axis into bands.
2110  *
2111  * **Optional parameters**
2112  *   - **factor** -- Fold by this factor, int.
2113  *
2114  * @param options Set of options.
2115  * @return Output image.
2116  */
2117 VImage bandfold( VOption *options = 0 ) const;
2118 
2119 /**
2120  * Bandwise join a set of images.
2121  * @param in Array of input images.
2122  * @param options Set of options.
2123  * @return Output image.
2124  */
2125 static VImage bandjoin( std::vector<VImage> in, VOption *options = 0 );
2126 
2127 /**
2128  * Append a constant band to an image.
2129  * @param c Array of constants to add.
2130  * @param options Set of options.
2131  * @return Output image.
2132  */
2133 VImage bandjoin_const( std::vector<double> c, VOption *options = 0 ) const;
2134 
2135 /**
2136  * Band-wise average.
2137  * @param options Set of options.
2138  * @return Output image.
2139  */
2140 VImage bandmean( VOption *options = 0 ) const;
2141 
2142 /**
2143  * Band-wise rank of a set of images.
2144  *
2145  * **Optional parameters**
2146  *   - **index** -- Select this band element from sorted list, int.
2147  *
2148  * @param in Array of input images.
2149  * @param options Set of options.
2150  * @return Output image.
2151  */
2152 static VImage bandrank( std::vector<VImage> in, VOption *options = 0 );
2153 
2154 /**
2155  * Unfold image bands into x axis.
2156  *
2157  * **Optional parameters**
2158  *   - **factor** -- Unfold by this factor, int.
2159  *
2160  * @param options Set of options.
2161  * @return Output image.
2162  */
2163 VImage bandunfold( VOption *options = 0 ) const;
2164 
2165 /**
2166  * Make a black image.
2167  *
2168  * **Optional parameters**
2169  *   - **bands** -- Number of bands in image, int.
2170  *
2171  * @param width Image width in pixels.
2172  * @param height Image height in pixels.
2173  * @param options Set of options.
2174  * @return Output image.
2175  */
2176 static VImage black( int width, int height, VOption *options = 0 );
2177 
2178 /**
2179  * Boolean operation on two images.
2180  * @param right Right-hand image argument.
2181  * @param boolean boolean to perform.
2182  * @param options Set of options.
2183  * @return Output image.
2184  */
2185 VImage boolean( VImage right, VipsOperationBoolean boolean, VOption *options = 0 ) const;
2186 
2187 /**
2188  * Boolean operations against a constant.
2189  * @param boolean boolean to perform.
2190  * @param c Array of constants.
2191  * @param options Set of options.
2192  * @return Output image.
2193  */
2194 VImage boolean_const( VipsOperationBoolean boolean, std::vector<double> c, VOption *options = 0 ) const;
2195 
2196 /**
2197  * Build a look-up table.
2198  * @param options Set of options.
2199  * @return Output image.
2200  */
2201 VImage buildlut( VOption *options = 0 ) const;
2202 
2203 /**
2204  * Byteswap an image.
2205  * @param options Set of options.
2206  * @return Output image.
2207  */
2208 VImage byteswap( VOption *options = 0 ) const;
2209 
2210 /**
2211  * Cache an image.
2212  *
2213  * **Optional parameters**
2214  *   - **max_tiles** -- Maximum number of tiles to cache, int.
2215  *   - **tile_height** -- Tile height in pixels, int.
2216  *   - **tile_width** -- Tile width in pixels, int.
2217  *
2218  * @param options Set of options.
2219  * @return Output image.
2220  */
2221 VImage cache( VOption *options = 0 ) const;
2222 
2223 /**
2224  * Canny edge detector.
2225  *
2226  * **Optional parameters**
2227  *   - **sigma** -- Sigma of Gaussian, double.
2228  *   - **precision** -- Convolve with this precision, VipsPrecision.
2229  *
2230  * @param options Set of options.
2231  * @return Output image.
2232  */
2233 VImage canny( VOption *options = 0 ) const;
2234 
2235 /**
2236  * Use pixel values to pick cases from an array of images.
2237  * @param cases Array of case images.
2238  * @param options Set of options.
2239  * @return Output image.
2240  */
2241 VImage case_image( std::vector<VImage> cases, VOption *options = 0 ) const;
2242 
2243 /**
2244  * Cast an image.
2245  *
2246  * **Optional parameters**
2247  *   - **shift** -- Shift integer values up and down, bool.
2248  *
2249  * @param format Format to cast to.
2250  * @param options Set of options.
2251  * @return Output image.
2252  */
2253 VImage cast( VipsBandFormat format, VOption *options = 0 ) const;
2254 
2255 /**
2256  * Convert to a new colorspace.
2257  *
2258  * **Optional parameters**
2259  *   - **source_space** -- Source color space, VipsInterpretation.
2260  *
2261  * @param space Destination color space.
2262  * @param options Set of options.
2263  * @return Output image.
2264  */
2265 VImage colourspace( VipsInterpretation space, VOption *options = 0 ) const;
2266 
2267 /**
2268  * Convolve with rotating mask.
2269  *
2270  * **Optional parameters**
2271  *   - **times** -- Rotate and convolve this many times, int.
2272  *   - **angle** -- Rotate mask by this much between convolutions, VipsAngle45.
2273  *   - **combine** -- Combine convolution results like this, VipsCombine.
2274  *   - **precision** -- Convolve with this precision, VipsPrecision.
2275  *   - **layers** -- Use this many layers in approximation, int.
2276  *   - **cluster** -- Cluster lines closer than this in approximation, int.
2277  *
2278  * @param mask Input matrix image.
2279  * @param options Set of options.
2280  * @return Output image.
2281  */
2282 VImage compass( VImage mask, VOption *options = 0 ) const;
2283 
2284 /**
2285  * Perform a complex operation on an image.
2286  * @param cmplx complex to perform.
2287  * @param options Set of options.
2288  * @return Output image.
2289  */
2290 VImage complex( VipsOperationComplex cmplx, VOption *options = 0 ) const;
2291 
2292 /**
2293  * Complex binary operations on two images.
2294  * @param right Right-hand image argument.
2295  * @param cmplx binary complex operation to perform.
2296  * @param options Set of options.
2297  * @return Output image.
2298  */
2299 VImage complex2( VImage right, VipsOperationComplex2 cmplx, VOption *options = 0 ) const;
2300 
2301 /**
2302  * Form a complex image from two real images.
2303  * @param right Right-hand image argument.
2304  * @param options Set of options.
2305  * @return Output image.
2306  */
2307 VImage complexform( VImage right, VOption *options = 0 ) const;
2308 
2309 /**
2310  * Get a component from a complex image.
2311  * @param get complex to perform.
2312  * @param options Set of options.
2313  * @return Output image.
2314  */
2315 VImage complexget( VipsOperationComplexget get, VOption *options = 0 ) const;
2316 
2317 /**
2318  * Blend an array of images with an array of blend modes.
2319  *
2320  * **Optional parameters**
2321  *   - **x** -- Array of x coordinates to join at, std::vector<int>.
2322  *   - **y** -- Array of y coordinates to join at, std::vector<int>.
2323  *   - **compositing_space** -- Composite images in this colour space, VipsInterpretation.
2324  *   - **premultiplied** -- Images have premultiplied alpha, bool.
2325  *
2326  * @param in Array of input images.
2327  * @param mode Array of VipsBlendMode to join with.
2328  * @param options Set of options.
2329  * @return Output image.
2330  */
2331 static VImage composite( std::vector<VImage> in, std::vector<int> mode, VOption *options = 0 );
2332 
2333 /**
2334  * Blend a pair of images with a blend mode.
2335  *
2336  * **Optional parameters**
2337  *   - **x** -- x position of overlay, int.
2338  *   - **y** -- y position of overlay, int.
2339  *   - **compositing_space** -- Composite images in this colour space, VipsInterpretation.
2340  *   - **premultiplied** -- Images have premultiplied alpha, bool.
2341  *
2342  * @param overlay Overlay image.
2343  * @param mode VipsBlendMode to join with.
2344  * @param options Set of options.
2345  * @return Output image.
2346  */
2347 VImage composite2( VImage overlay, VipsBlendMode mode, VOption *options = 0 ) const;
2348 
2349 /**
2350  * Convolution operation.
2351  *
2352  * **Optional parameters**
2353  *   - **precision** -- Convolve with this precision, VipsPrecision.
2354  *   - **layers** -- Use this many layers in approximation, int.
2355  *   - **cluster** -- Cluster lines closer than this in approximation, int.
2356  *
2357  * @param mask Input matrix image.
2358  * @param options Set of options.
2359  * @return Output image.
2360  */
2361 VImage conv( VImage mask, VOption *options = 0 ) const;
2362 
2363 /**
2364  * Approximate integer convolution.
2365  *
2366  * **Optional parameters**
2367  *   - **layers** -- Use this many layers in approximation, int.
2368  *   - **cluster** -- Cluster lines closer than this in approximation, int.
2369  *
2370  * @param mask Input matrix image.
2371  * @param options Set of options.
2372  * @return Output image.
2373  */
2374 VImage conva( VImage mask, VOption *options = 0 ) const;
2375 
2376 /**
2377  * Approximate separable integer convolution.
2378  *
2379  * **Optional parameters**
2380  *   - **layers** -- Use this many layers in approximation, int.
2381  *
2382  * @param mask Input matrix image.
2383  * @param options Set of options.
2384  * @return Output image.
2385  */
2386 VImage convasep( VImage mask, VOption *options = 0 ) const;
2387 
2388 /**
2389  * Float convolution operation.
2390  * @param mask Input matrix image.
2391  * @param options Set of options.
2392  * @return Output image.
2393  */
2394 VImage convf( VImage mask, VOption *options = 0 ) const;
2395 
2396 /**
2397  * Int convolution operation.
2398  * @param mask Input matrix image.
2399  * @param options Set of options.
2400  * @return Output image.
2401  */
2402 VImage convi( VImage mask, VOption *options = 0 ) const;
2403 
2404 /**
2405  * Seperable convolution operation.
2406  *
2407  * **Optional parameters**
2408  *   - **precision** -- Convolve with this precision, VipsPrecision.
2409  *   - **layers** -- Use this many layers in approximation, int.
2410  *   - **cluster** -- Cluster lines closer than this in approximation, int.
2411  *
2412  * @param mask Input matrix image.
2413  * @param options Set of options.
2414  * @return Output image.
2415  */
2416 VImage convsep( VImage mask, VOption *options = 0 ) const;
2417 
2418 /**
2419  * Copy an image.
2420  *
2421  * **Optional parameters**
2422  *   - **width** -- Image width in pixels, int.
2423  *   - **height** -- Image height in pixels, int.
2424  *   - **bands** -- Number of bands in image, int.
2425  *   - **format** -- Pixel format in image, VipsBandFormat.
2426  *   - **coding** -- Pixel coding, VipsCoding.
2427  *   - **interpretation** -- Pixel interpretation, VipsInterpretation.
2428  *   - **xres** -- Horizontal resolution in pixels/mm, double.
2429  *   - **yres** -- Vertical resolution in pixels/mm, double.
2430  *   - **xoffset** -- Horizontal offset of origin, int.
2431  *   - **yoffset** -- Vertical offset of origin, int.
2432  *
2433  * @param options Set of options.
2434  * @return Output image.
2435  */
2436 VImage copy( VOption *options = 0 ) const;
2437 
2438 /**
2439  * Count lines in an image.
2440  * @param direction Countlines left-right or up-down.
2441  * @param options Set of options.
2442  * @return Number of lines.
2443  */
2444 double countlines( VipsDirection direction, VOption *options = 0 ) const;
2445 
2446 /**
2447  * Extract an area from an image.
2448  * @param left Left edge of extract area.
2449  * @param top Top edge of extract area.
2450  * @param width Width of extract area.
2451  * @param height Height of extract area.
2452  * @param options Set of options.
2453  * @return Output image.
2454  */
2455 VImage crop( int left, int top, int width, int height, VOption *options = 0 ) const;
2456 
2457 /**
2458  * Load csv.
2459  *
2460  * **Optional parameters**
2461  *   - **skip** -- Skip this many lines at the start of the file, int.
2462  *   - **lines** -- Read this many lines from the file, int.
2463  *   - **whitespace** -- Set of whitespace characters, const char *.
2464  *   - **separator** -- Set of separator characters, const char *.
2465  *   - **memory** -- Force open via memory, bool.
2466  *   - **access** -- Required access pattern for this file, VipsAccess.
2467  *   - **fail_on** -- Error level to fail on, VipsFailOn.
2468  *
2469  * @param filename Filename to load from.
2470  * @param options Set of options.
2471  * @return Output image.
2472  */
2473 static VImage csvload( const char *filename, VOption *options = 0 );
2474 
2475 /**
2476  * Load csv.
2477  *
2478  * **Optional parameters**
2479  *   - **skip** -- Skip this many lines at the start of the file, int.
2480  *   - **lines** -- Read this many lines from the file, int.
2481  *   - **whitespace** -- Set of whitespace characters, const char *.
2482  *   - **separator** -- Set of separator characters, const char *.
2483  *   - **memory** -- Force open via memory, bool.
2484  *   - **access** -- Required access pattern for this file, VipsAccess.
2485  *   - **fail_on** -- Error level to fail on, VipsFailOn.
2486  *
2487  * @param source Source to load from.
2488  * @param options Set of options.
2489  * @return Output image.
2490  */
2491 static VImage csvload_source( VSource source, VOption *options = 0 );
2492 
2493 /**
2494  * Save image to csv.
2495  *
2496  * **Optional parameters**
2497  *   - **separator** -- Separator characters, const char *.
2498  *   - **strip** -- Strip all metadata from image, bool.
2499  *   - **background** -- Background value, std::vector<double>.
2500  *   - **page_height** -- Set page height for multipage save, int.
2501  *
2502  * @param filename Filename to save to.
2503  * @param options Set of options.
2504  */
2505 void csvsave( const char *filename, VOption *options = 0 ) const;
2506 
2507 /**
2508  * Save image to csv.
2509  *
2510  * **Optional parameters**
2511  *   - **separator** -- Separator characters, const char *.
2512  *   - **strip** -- Strip all metadata from image, bool.
2513  *   - **background** -- Background value, std::vector<double>.
2514  *   - **page_height** -- Set page height for multipage save, int.
2515  *
2516  * @param target Target to save to.
2517  * @param options Set of options.
2518  */
2519 void csvsave_target( VTarget target, VOption *options = 0 ) const;
2520 
2521 /**
2522  * Calculate de00.
2523  * @param right Right-hand input image.
2524  * @param options Set of options.
2525  * @return Output image.
2526  */
2527 VImage dE00( VImage right, VOption *options = 0 ) const;
2528 
2529 /**
2530  * Calculate de76.
2531  * @param right Right-hand input image.
2532  * @param options Set of options.
2533  * @return Output image.
2534  */
2535 VImage dE76( VImage right, VOption *options = 0 ) const;
2536 
2537 /**
2538  * Calculate decmc.
2539  * @param right Right-hand input image.
2540  * @param options Set of options.
2541  * @return Output image.
2542  */
2543 VImage dECMC( VImage right, VOption *options = 0 ) const;
2544 
2545 /**
2546  * Find image standard deviation.
2547  * @param options Set of options.
2548  * @return Output value.
2549  */
2550 double deviate( VOption *options = 0 ) const;
2551 
2552 /**
2553  * Divide two images.
2554  * @param right Right-hand image argument.
2555  * @param options Set of options.
2556  * @return Output image.
2557  */
2558 VImage divide( VImage right, VOption *options = 0 ) const;
2559 
2560 /**
2561  * Draw a circle on an image.
2562  *
2563  * **Optional parameters**
2564  *   - **fill** -- Draw a solid object, bool.
2565  *
2566  * @param ink Color for pixels.
2567  * @param cx Centre of draw_circle.
2568  * @param cy Centre of draw_circle.
2569  * @param radius Radius in pixels.
2570  * @param options Set of options.
2571  */
2572 void draw_circle( std::vector<double> ink, int cx, int cy, int radius, VOption *options = 0 ) const;
2573 
2574 /**
2575  * Flood-fill an area.
2576  *
2577  * **Optional parameters**
2578  *   - **test** -- Test pixels in this image, VImage.
2579  *   - **equal** -- DrawFlood while equal to edge, bool.
2580  *
2581  * @param ink Color for pixels.
2582  * @param x DrawFlood start point.
2583  * @param y DrawFlood start point.
2584  * @param options Set of options.
2585  */
2586 void draw_flood( std::vector<double> ink, int x, int y, VOption *options = 0 ) const;
2587 
2588 /**
2589  * Paint an image into another image.
2590  *
2591  * **Optional parameters**
2592  *   - **mode** -- Combining mode, VipsCombineMode.
2593  *
2594  * @param sub Sub-image to insert into main image.
2595  * @param x Draw image here.
2596  * @param y Draw image here.
2597  * @param options Set of options.
2598  */
2599 void draw_image( VImage sub, int x, int y, VOption *options = 0 ) const;
2600 
2601 /**
2602  * Draw a line on an image.
2603  * @param ink Color for pixels.
2604  * @param x1 Start of draw_line.
2605  * @param y1 Start of draw_line.
2606  * @param x2 End of draw_line.
2607  * @param y2 End of draw_line.
2608  * @param options Set of options.
2609  */
2610 void draw_line( std::vector<double> ink, int x1, int y1, int x2, int y2, VOption *options = 0 ) const;
2611 
2612 /**
2613  * Draw a mask on an image.
2614  * @param ink Color for pixels.
2615  * @param mask Mask of pixels to draw.
2616  * @param x Draw mask here.
2617  * @param y Draw mask here.
2618  * @param options Set of options.
2619  */
2620 void draw_mask( std::vector<double> ink, VImage mask, int x, int y, VOption *options = 0 ) const;
2621 
2622 /**
2623  * Paint a rectangle on an image.
2624  *
2625  * **Optional parameters**
2626  *   - **fill** -- Draw a solid object, bool.
2627  *
2628  * @param ink Color for pixels.
2629  * @param left Rect to fill.
2630  * @param top Rect to fill.
2631  * @param width Rect to fill.
2632  * @param height Rect to fill.
2633  * @param options Set of options.
2634  */
2635 void draw_rect( std::vector<double> ink, int left, int top, int width, int height, VOption *options = 0 ) const;
2636 
2637 /**
2638  * Blur a rectangle on an image.
2639  * @param left Rect to fill.
2640  * @param top Rect to fill.
2641  * @param width Rect to fill.
2642  * @param height Rect to fill.
2643  * @param options Set of options.
2644  */
2645 void draw_smudge( int left, int top, int width, int height, VOption *options = 0 ) const;
2646 
2647 /**
2648  * Save image to deepzoom file.
2649  *
2650  * **Optional parameters**
2651  *   - **basename** -- Base name to save to, const char *.
2652  *   - **layout** -- Directory layout, VipsForeignDzLayout.
2653  *   - **suffix** -- Filename suffix for tiles, const char *.
2654  *   - **overlap** -- Tile overlap in pixels, int.
2655  *   - **tile_size** -- Tile size in pixels, int.
2656  *   - **centre** -- Center image in tile, bool.
2657  *   - **depth** -- Pyramid depth, VipsForeignDzDepth.
2658  *   - **angle** -- Rotate image during save, VipsAngle.
2659  *   - **container** -- Pyramid container type, VipsForeignDzContainer.
2660  *   - **properties** -- Write a properties file to the output directory, bool.
2661  *   - **compression** -- ZIP deflate compression level, int.
2662  *   - **region_shrink** -- Method to shrink regions, VipsRegionShrink.
2663  *   - **skip_blanks** -- Skip tiles which are nearly equal to the background, int.
2664  *   - **no_strip** -- Don't strip tile metadata, bool.
2665  *   - **id** -- Resource ID, const char *.
2666  *   - **strip** -- Strip all metadata from image, bool.
2667  *   - **background** -- Background value, std::vector<double>.
2668  *   - **page_height** -- Set page height for multipage save, int.
2669  *
2670  * @param filename Filename to save to.
2671  * @param options Set of options.
2672  */
2673 void dzsave( const char *filename, VOption *options = 0 ) const;
2674 
2675 /**
2676  * Save image to dz buffer.
2677  *
2678  * **Optional parameters**
2679  *   - **basename** -- Base name to save to, const char *.
2680  *   - **layout** -- Directory layout, VipsForeignDzLayout.
2681  *   - **suffix** -- Filename suffix for tiles, const char *.
2682  *   - **overlap** -- Tile overlap in pixels, int.
2683  *   - **tile_size** -- Tile size in pixels, int.
2684  *   - **centre** -- Center image in tile, bool.
2685  *   - **depth** -- Pyramid depth, VipsForeignDzDepth.
2686  *   - **angle** -- Rotate image during save, VipsAngle.
2687  *   - **container** -- Pyramid container type, VipsForeignDzContainer.
2688  *   - **properties** -- Write a properties file to the output directory, bool.
2689  *   - **compression** -- ZIP deflate compression level, int.
2690  *   - **region_shrink** -- Method to shrink regions, VipsRegionShrink.
2691  *   - **skip_blanks** -- Skip tiles which are nearly equal to the background, int.
2692  *   - **no_strip** -- Don't strip tile metadata, bool.
2693  *   - **id** -- Resource ID, const char *.
2694  *   - **strip** -- Strip all metadata from image, bool.
2695  *   - **background** -- Background value, std::vector<double>.
2696  *   - **page_height** -- Set page height for multipage save, int.
2697  *
2698  * @param options Set of options.
2699  * @return Buffer to save to.
2700  */
2701 VipsBlob *dzsave_buffer( VOption *options = 0 ) const;
2702 
2703 /**
2704  * Embed an image in a larger image.
2705  *
2706  * **Optional parameters**
2707  *   - **extend** -- How to generate the extra pixels, VipsExtend.
2708  *   - **background** -- Color for background pixels, std::vector<double>.
2709  *
2710  * @param x Left edge of input in output.
2711  * @param y Top edge of input in output.
2712  * @param width Image width in pixels.
2713  * @param height Image height in pixels.
2714  * @param options Set of options.
2715  * @return Output image.
2716  */
2717 VImage embed( int x, int y, int width, int height, VOption *options = 0 ) const;
2718 
2719 /**
2720  * Extract an area from an image.
2721  * @param left Left edge of extract area.
2722  * @param top Top edge of extract area.
2723  * @param width Width of extract area.
2724  * @param height Height of extract area.
2725  * @param options Set of options.
2726  * @return Output image.
2727  */
2728 VImage extract_area( int left, int top, int width, int height, VOption *options = 0 ) const;
2729 
2730 /**
2731  * Extract band from an image.
2732  *
2733  * **Optional parameters**
2734  *   - **n** -- Number of bands to extract, int.
2735  *
2736  * @param band Band to extract.
2737  * @param options Set of options.
2738  * @return Output image.
2739  */
2740 VImage extract_band( int band, VOption *options = 0 ) const;
2741 
2742 /**
2743  * Make an image showing the eye's spatial response.
2744  *
2745  * **Optional parameters**
2746  *   - **uchar** -- Output an unsigned char image, bool.
2747  *   - **factor** -- Maximum spatial frequency, double.
2748  *
2749  * @param width Image width in pixels.
2750  * @param height Image height in pixels.
2751  * @param options Set of options.
2752  * @return Output image.
2753  */
2754 static VImage eye( int width, int height, VOption *options = 0 );
2755 
2756 /**
2757  * False-color an image.
2758  * @param options Set of options.
2759  * @return Output image.
2760  */
2761 VImage falsecolour( VOption *options = 0 ) const;
2762 
2763 /**
2764  * Fast correlation.
2765  * @param ref Input reference image.
2766  * @param options Set of options.
2767  * @return Output image.
2768  */
2769 VImage fastcor( VImage ref, VOption *options = 0 ) const;
2770 
2771 /**
2772  * Fill image zeros with nearest non-zero pixel.
2773  * @param options Set of options.
2774  * @return Value of nearest non-zero pixel.
2775  */
2776 VImage fill_nearest( VOption *options = 0 ) const;
2777 
2778 /**
2779  * Search an image for non-edge areas.
2780  *
2781  * **Optional parameters**
2782  *   - **threshold** -- Object threshold, double.
2783  *   - **background** -- Color for background pixels, std::vector<double>.
2784  *
2785  * @param top Top edge of extract area.
2786  * @param width Width of extract area.
2787  * @param height Height of extract area.
2788  * @param options Set of options.
2789  * @return Left edge of image.
2790  */
2791 int find_trim( int *top, int *width, int *height, VOption *options = 0 ) const;
2792 
2793 /**
2794  * Load a fits image.
2795  *
2796  * **Optional parameters**
2797  *   - **memory** -- Force open via memory, bool.
2798  *   - **access** -- Required access pattern for this file, VipsAccess.
2799  *   - **fail_on** -- Error level to fail on, VipsFailOn.
2800  *
2801  * @param filename Filename to load from.
2802  * @param options Set of options.
2803  * @return Output image.
2804  */
2805 static VImage fitsload( const char *filename, VOption *options = 0 );
2806 
2807 /**
2808  * Load fits from a source.
2809  *
2810  * **Optional parameters**
2811  *   - **memory** -- Force open via memory, bool.
2812  *   - **access** -- Required access pattern for this file, VipsAccess.
2813  *   - **fail_on** -- Error level to fail on, VipsFailOn.
2814  *
2815  * @param source Source to load from.
2816  * @param options Set of options.
2817  * @return Output image.
2818  */
2819 static VImage fitsload_source( VSource source, VOption *options = 0 );
2820 
2821 /**
2822  * Save image to fits file.
2823  *
2824  * **Optional parameters**
2825  *   - **strip** -- Strip all metadata from image, bool.
2826  *   - **background** -- Background value, std::vector<double>.
2827  *   - **page_height** -- Set page height for multipage save, int.
2828  *
2829  * @param filename Filename to save to.
2830  * @param options Set of options.
2831  */
2832 void fitssave( const char *filename, VOption *options = 0 ) const;
2833 
2834 /**
2835  * Flatten alpha out of an image.
2836  *
2837  * **Optional parameters**
2838  *   - **background** -- Background value, std::vector<double>.
2839  *   - **max_alpha** -- Maximum value of alpha channel, double.
2840  *
2841  * @param options Set of options.
2842  * @return Output image.
2843  */
2844 VImage flatten( VOption *options = 0 ) const;
2845 
2846 /**
2847  * Flip an image.
2848  * @param direction Direction to flip image.
2849  * @param options Set of options.
2850  * @return Output image.
2851  */
2852 VImage flip( VipsDirection direction, VOption *options = 0 ) const;
2853 
2854 /**
2855  * Transform float rgb to radiance coding.
2856  * @param options Set of options.
2857  * @return Output image.
2858  */
2859 VImage float2rad( VOption *options = 0 ) const;
2860 
2861 /**
2862  * Make a fractal surface.
2863  * @param width Image width in pixels.
2864  * @param height Image height in pixels.
2865  * @param fractal_dimension Fractal dimension.
2866  * @param options Set of options.
2867  * @return Output image.
2868  */
2869 static VImage fractsurf( int width, int height, double fractal_dimension, VOption *options = 0 );
2870 
2871 /**
2872  * Frequency-domain filtering.
2873  * @param mask Input mask image.
2874  * @param options Set of options.
2875  * @return Output image.
2876  */
2877 VImage freqmult( VImage mask, VOption *options = 0 ) const;
2878 
2879 /**
2880  * Forward fft.
2881  * @param options Set of options.
2882  * @return Output image.
2883  */
2884 VImage fwfft( VOption *options = 0 ) const;
2885 
2886 /**
2887  * Gamma an image.
2888  *
2889  * **Optional parameters**
2890  *   - **exponent** -- Gamma factor, double.
2891  *
2892  * @param options Set of options.
2893  * @return Output image.
2894  */
2895 VImage gamma( VOption *options = 0 ) const;
2896 
2897 /**
2898  * Gaussian blur.
2899  *
2900  * **Optional parameters**
2901  *   - **min_ampl** -- Minimum amplitude of Gaussian, double.
2902  *   - **precision** -- Convolve with this precision, VipsPrecision.
2903  *
2904  * @param sigma Sigma of Gaussian.
2905  * @param options Set of options.
2906  * @return Output image.
2907  */
2908 VImage gaussblur( double sigma, VOption *options = 0 ) const;
2909 
2910 /**
2911  * Make a gaussian image.
2912  *
2913  * **Optional parameters**
2914  *   - **separable** -- Generate separable Gaussian, bool.
2915  *   - **precision** -- Generate with this precision, VipsPrecision.
2916  *
2917  * @param sigma Sigma of Gaussian.
2918  * @param min_ampl Minimum amplitude of Gaussian.
2919  * @param options Set of options.
2920  * @return Output image.
2921  */
2922 static VImage gaussmat( double sigma, double min_ampl, VOption *options = 0 );
2923 
2924 /**
2925  * Make a gaussnoise image.
2926  *
2927  * **Optional parameters**
2928  *   - **sigma** -- Standard deviation of pixels in generated image, double.
2929  *   - **mean** -- Mean of pixels in generated image, double.
2930  *   - **seed** -- Random number seed, int.
2931  *
2932  * @param width Image width in pixels.
2933  * @param height Image height in pixels.
2934  * @param options Set of options.
2935  * @return Output image.
2936  */
2937 static VImage gaussnoise( int width, int height, VOption *options = 0 );
2938 
2939 /**
2940  * Read a point from an image.
2941  * @param x Point to read.
2942  * @param y Point to read.
2943  * @param options Set of options.
2944  * @return Array of output values.
2945  */
2946 std::vector<double> getpoint( int x, int y, VOption *options = 0 ) const;
2947 
2948 /**
2949  * Load gif with libnsgif.
2950  *
2951  * **Optional parameters**
2952  *   - **n** -- Load this many pages, int.
2953  *   - **page** -- Load this page from the file, int.
2954  *   - **memory** -- Force open via memory, bool.
2955  *   - **access** -- Required access pattern for this file, VipsAccess.
2956  *   - **fail_on** -- Error level to fail on, VipsFailOn.
2957  *
2958  * @param filename Filename to load from.
2959  * @param options Set of options.
2960  * @return Output image.
2961  */
2962 static VImage gifload( const char *filename, VOption *options = 0 );
2963 
2964 /**
2965  * Load gif with libnsgif.
2966  *
2967  * **Optional parameters**
2968  *   - **n** -- Load this many pages, int.
2969  *   - **page** -- Load this page from the file, int.
2970  *   - **memory** -- Force open via memory, bool.
2971  *   - **access** -- Required access pattern for this file, VipsAccess.
2972  *   - **fail_on** -- Error level to fail on, VipsFailOn.
2973  *
2974  * @param buffer Buffer to load from.
2975  * @param options Set of options.
2976  * @return Output image.
2977  */
2978 static VImage gifload_buffer( VipsBlob *buffer, VOption *options = 0 );
2979 
2980 /**
2981  * Load gif from source.
2982  *
2983  * **Optional parameters**
2984  *   - **n** -- Load this many pages, int.
2985  *   - **page** -- Load this page from the file, int.
2986  *   - **memory** -- Force open via memory, bool.
2987  *   - **access** -- Required access pattern for this file, VipsAccess.
2988  *   - **fail_on** -- Error level to fail on, VipsFailOn.
2989  *
2990  * @param source Source to load from.
2991  * @param options Set of options.
2992  * @return Output image.
2993  */
2994 static VImage gifload_source( VSource source, VOption *options = 0 );
2995 
2996 /**
2997  * Save as gif.
2998  *
2999  * **Optional parameters**
3000  *   - **dither** -- Amount of dithering, double.
3001  *   - **effort** -- Quantisation effort, int.
3002  *   - **bitdepth** -- Number of bits per pixel, int.
3003  *   - **strip** -- Strip all metadata from image, bool.
3004  *   - **background** -- Background value, std::vector<double>.
3005  *   - **page_height** -- Set page height for multipage save, int.
3006  *
3007  * @param filename Filename to save to.
3008  * @param options Set of options.
3009  */
3010 void gifsave( const char *filename, VOption *options = 0 ) const;
3011 
3012 /**
3013  * Save as gif.
3014  *
3015  * **Optional parameters**
3016  *   - **dither** -- Amount of dithering, double.
3017  *   - **effort** -- Quantisation effort, int.
3018  *   - **bitdepth** -- Number of bits per pixel, int.
3019  *   - **strip** -- Strip all metadata from image, bool.
3020  *   - **background** -- Background value, std::vector<double>.
3021  *   - **page_height** -- Set page height for multipage save, int.
3022  *
3023  * @param options Set of options.
3024  * @return Buffer to save to.
3025  */
3026 VipsBlob *gifsave_buffer( VOption *options = 0 ) const;
3027 
3028 /**
3029  * Save as gif.
3030  *
3031  * **Optional parameters**
3032  *   - **dither** -- Amount of dithering, double.
3033  *   - **effort** -- Quantisation effort, int.
3034  *   - **bitdepth** -- Number of bits per pixel, int.
3035  *   - **strip** -- Strip all metadata from image, bool.
3036  *   - **background** -- Background value, std::vector<double>.
3037  *   - **page_height** -- Set page height for multipage save, int.
3038  *
3039  * @param target Target to save to.
3040  * @param options Set of options.
3041  */
3042 void gifsave_target( VTarget target, VOption *options = 0 ) const;
3043 
3044 /**
3045  * Global balance an image mosaic.
3046  *
3047  * **Optional parameters**
3048  *   - **gamma** -- Image gamma, double.
3049  *   - **int_output** -- Integer output, bool.
3050  *
3051  * @param options Set of options.
3052  * @return Output image.
3053  */
3054 VImage globalbalance( VOption *options = 0 ) const;
3055 
3056 /**
3057  * Place an image within a larger image with a certain gravity.
3058  *
3059  * **Optional parameters**
3060  *   - **extend** -- How to generate the extra pixels, VipsExtend.
3061  *   - **background** -- Color for background pixels, std::vector<double>.
3062  *
3063  * @param direction direction to place image within width/height.
3064  * @param width Image width in pixels.
3065  * @param height Image height in pixels.
3066  * @param options Set of options.
3067  * @return Output image.
3068  */
3069 VImage gravity( VipsCompassDirection direction, int width, int height, VOption *options = 0 ) const;
3070 
3071 /**
3072  * Make a grey ramp image.
3073  *
3074  * **Optional parameters**
3075  *   - **uchar** -- Output an unsigned char image, bool.
3076  *
3077  * @param width Image width in pixels.
3078  * @param height Image height in pixels.
3079  * @param options Set of options.
3080  * @return Output image.
3081  */
3082 static VImage grey( int width, int height, VOption *options = 0 );
3083 
3084 /**
3085  * Grid an image.
3086  * @param tile_height chop into tiles this high.
3087  * @param across number of tiles across.
3088  * @param down number of tiles down.
3089  * @param options Set of options.
3090  * @return Output image.
3091  */
3092 VImage grid( int tile_height, int across, int down, VOption *options = 0 ) const;
3093 
3094 /**
3095  * Load a heif image.
3096  *
3097  * **Optional parameters**
3098  *   - **page** -- Load this page from the file, int.
3099  *   - **n** -- Load this many pages, int.
3100  *   - **thumbnail** -- Fetch thumbnail image, bool.
3101  *   - **memory** -- Force open via memory, bool.
3102  *   - **access** -- Required access pattern for this file, VipsAccess.
3103  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3104  *
3105  * @param filename Filename to load from.
3106  * @param options Set of options.
3107  * @return Output image.
3108  */
3109 static VImage heifload( const char *filename, VOption *options = 0 );
3110 
3111 /**
3112  * Load a heif image.
3113  *
3114  * **Optional parameters**
3115  *   - **page** -- Load this page from the file, int.
3116  *   - **n** -- Load this many pages, int.
3117  *   - **thumbnail** -- Fetch thumbnail image, bool.
3118  *   - **memory** -- Force open via memory, bool.
3119  *   - **access** -- Required access pattern for this file, VipsAccess.
3120  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3121  *
3122  * @param buffer Buffer to load from.
3123  * @param options Set of options.
3124  * @return Output image.
3125  */
3126 static VImage heifload_buffer( VipsBlob *buffer, VOption *options = 0 );
3127 
3128 /**
3129  * Load a heif image.
3130  *
3131  * **Optional parameters**
3132  *   - **page** -- Load this page from the file, int.
3133  *   - **n** -- Load this many pages, int.
3134  *   - **thumbnail** -- Fetch thumbnail image, bool.
3135  *   - **memory** -- Force open via memory, bool.
3136  *   - **access** -- Required access pattern for this file, VipsAccess.
3137  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3138  *
3139  * @param source Source to load from.
3140  * @param options Set of options.
3141  * @return Output image.
3142  */
3143 static VImage heifload_source( VSource source, VOption *options = 0 );
3144 
3145 /**
3146  * Save image in heif format.
3147  *
3148  * **Optional parameters**
3149  *   - **Q** -- Q factor, int.
3150  *   - **lossless** -- Enable lossless compression, bool.
3151  *   - **compression** -- Compression format, VipsForeignHeifCompression.
3152  *   - **effort** -- CPU effort, int.
3153  *   - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample.
3154  *   - **strip** -- Strip all metadata from image, bool.
3155  *   - **background** -- Background value, std::vector<double>.
3156  *   - **page_height** -- Set page height for multipage save, int.
3157  *
3158  * @param filename Filename to save to.
3159  * @param options Set of options.
3160  */
3161 void heifsave( const char *filename, VOption *options = 0 ) const;
3162 
3163 /**
3164  * Save image in heif format.
3165  *
3166  * **Optional parameters**
3167  *   - **Q** -- Q factor, int.
3168  *   - **lossless** -- Enable lossless compression, bool.
3169  *   - **compression** -- Compression format, VipsForeignHeifCompression.
3170  *   - **effort** -- CPU effort, int.
3171  *   - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample.
3172  *   - **strip** -- Strip all metadata from image, bool.
3173  *   - **background** -- Background value, std::vector<double>.
3174  *   - **page_height** -- Set page height for multipage save, int.
3175  *
3176  * @param options Set of options.
3177  * @return Buffer to save to.
3178  */
3179 VipsBlob *heifsave_buffer( VOption *options = 0 ) const;
3180 
3181 /**
3182  * Save image in heif format.
3183  *
3184  * **Optional parameters**
3185  *   - **Q** -- Q factor, int.
3186  *   - **lossless** -- Enable lossless compression, bool.
3187  *   - **compression** -- Compression format, VipsForeignHeifCompression.
3188  *   - **effort** -- CPU effort, int.
3189  *   - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample.
3190  *   - **strip** -- Strip all metadata from image, bool.
3191  *   - **background** -- Background value, std::vector<double>.
3192  *   - **page_height** -- Set page height for multipage save, int.
3193  *
3194  * @param target Target to save to.
3195  * @param options Set of options.
3196  */
3197 void heifsave_target( VTarget target, VOption *options = 0 ) const;
3198 
3199 /**
3200  * Form cumulative histogram.
3201  * @param options Set of options.
3202  * @return Output image.
3203  */
3204 VImage hist_cum( VOption *options = 0 ) const;
3205 
3206 /**
3207  * Estimate image entropy.
3208  * @param options Set of options.
3209  * @return Output value.
3210  */
3211 double hist_entropy( VOption *options = 0 ) const;
3212 
3213 /**
3214  * Histogram equalisation.
3215  *
3216  * **Optional parameters**
3217  *   - **band** -- Equalise with this band, int.
3218  *
3219  * @param options Set of options.
3220  * @return Output image.
3221  */
3222 VImage hist_equal( VOption *options = 0 ) const;
3223 
3224 /**
3225  * Find image histogram.
3226  *
3227  * **Optional parameters**
3228  *   - **band** -- Find histogram of band, int.
3229  *
3230  * @param options Set of options.
3231  * @return Output histogram.
3232  */
3233 VImage hist_find( VOption *options = 0 ) const;
3234 
3235 /**
3236  * Find indexed image histogram.
3237  *
3238  * **Optional parameters**
3239  *   - **combine** -- Combine bins like this, VipsCombine.
3240  *
3241  * @param index Index image.
3242  * @param options Set of options.
3243  * @return Output histogram.
3244  */
3245 VImage hist_find_indexed( VImage index, VOption *options = 0 ) const;
3246 
3247 /**
3248  * Find n-dimensional image histogram.
3249  *
3250  * **Optional parameters**
3251  *   - **bins** -- Number of bins in each dimension, int.
3252  *
3253  * @param options Set of options.
3254  * @return Output histogram.
3255  */
3256 VImage hist_find_ndim( VOption *options = 0 ) const;
3257 
3258 /**
3259  * Test for monotonicity.
3260  * @param options Set of options.
3261  * @return true if in is monotonic.
3262  */
3263 bool hist_ismonotonic( VOption *options = 0 ) const;
3264 
3265 /**
3266  * Local histogram equalisation.
3267  *
3268  * **Optional parameters**
3269  *   - **max_slope** -- Maximum slope (CLAHE), int.
3270  *
3271  * @param width Window width in pixels.
3272  * @param height Window height in pixels.
3273  * @param options Set of options.
3274  * @return Output image.
3275  */
3276 VImage hist_local( int width, int height, VOption *options = 0 ) const;
3277 
3278 /**
3279  * Match two histograms.
3280  * @param ref Reference histogram.
3281  * @param options Set of options.
3282  * @return Output image.
3283  */
3284 VImage hist_match( VImage ref, VOption *options = 0 ) const;
3285 
3286 /**
3287  * Normalise histogram.
3288  * @param options Set of options.
3289  * @return Output image.
3290  */
3291 VImage hist_norm( VOption *options = 0 ) const;
3292 
3293 /**
3294  * Plot histogram.
3295  * @param options Set of options.
3296  * @return Output image.
3297  */
3298 VImage hist_plot( VOption *options = 0 ) const;
3299 
3300 /**
3301  * Find hough circle transform.
3302  *
3303  * **Optional parameters**
3304  *   - **scale** -- Scale down dimensions by this factor, int.
3305  *   - **min_radius** -- Smallest radius to search for, int.
3306  *   - **max_radius** -- Largest radius to search for, int.
3307  *
3308  * @param options Set of options.
3309  * @return Output image.
3310  */
3311 VImage hough_circle( VOption *options = 0 ) const;
3312 
3313 /**
3314  * Find hough line transform.
3315  *
3316  * **Optional parameters**
3317  *   - **width** -- horizontal size of parameter space, int.
3318  *   - **height** -- Vertical size of parameter space, int.
3319  *
3320  * @param options Set of options.
3321  * @return Output image.
3322  */
3323 VImage hough_line( VOption *options = 0 ) const;
3324 
3325 /**
3326  * Output to device with icc profile.
3327  *
3328  * **Optional parameters**
3329  *   - **pcs** -- Set Profile Connection Space, VipsPCS.
3330  *   - **intent** -- Rendering intent, VipsIntent.
3331  *   - **black_point_compensation** -- Enable black point compensation, bool.
3332  *   - **output_profile** -- Filename to load output profile from, const char *.
3333  *   - **depth** -- Output device space depth in bits, int.
3334  *
3335  * @param options Set of options.
3336  * @return Output image.
3337  */
3338 VImage icc_export( VOption *options = 0 ) const;
3339 
3340 /**
3341  * Import from device with icc profile.
3342  *
3343  * **Optional parameters**
3344  *   - **pcs** -- Set Profile Connection Space, VipsPCS.
3345  *   - **intent** -- Rendering intent, VipsIntent.
3346  *   - **black_point_compensation** -- Enable black point compensation, bool.
3347  *   - **embedded** -- Use embedded input profile, if available, bool.
3348  *   - **input_profile** -- Filename to load input profile from, const char *.
3349  *
3350  * @param options Set of options.
3351  * @return Output image.
3352  */
3353 VImage icc_import( VOption *options = 0 ) const;
3354 
3355 /**
3356  * Transform between devices with icc profiles.
3357  *
3358  * **Optional parameters**
3359  *   - **pcs** -- Set Profile Connection Space, VipsPCS.
3360  *   - **intent** -- Rendering intent, VipsIntent.
3361  *   - **black_point_compensation** -- Enable black point compensation, bool.
3362  *   - **embedded** -- Use embedded input profile, if available, bool.
3363  *   - **input_profile** -- Filename to load input profile from, const char *.
3364  *   - **depth** -- Output device space depth in bits, int.
3365  *
3366  * @param output_profile Filename to load output profile from.
3367  * @param options Set of options.
3368  * @return Output image.
3369  */
3370 VImage icc_transform( const char *output_profile, VOption *options = 0 ) const;
3371 
3372 /**
3373  * Make a 1d image where pixel values are indexes.
3374  *
3375  * **Optional parameters**
3376  *   - **bands** -- Number of bands in LUT, int.
3377  *   - **ushort** -- Create a 16-bit LUT, bool.
3378  *   - **size** -- Size of 16-bit LUT, int.
3379  *
3380  * @param options Set of options.
3381  * @return Output image.
3382  */
3383 static VImage identity( VOption *options = 0 );
3384 
3385 /**
3386  * Ifthenelse an image.
3387  *
3388  * **Optional parameters**
3389  *   - **blend** -- Blend smoothly between then and else parts, bool.
3390  *
3391  * @param in1 Source for TRUE pixels.
3392  * @param in2 Source for FALSE pixels.
3393  * @param options Set of options.
3394  * @return Output image.
3395  */
3396 VImage ifthenelse( VImage in1, VImage in2, VOption *options = 0 ) const;
3397 
3398 /**
3399  * Insert image @sub into @main at @x, @y.
3400  *
3401  * **Optional parameters**
3402  *   - **expand** -- Expand output to hold all of both inputs, bool.
3403  *   - **background** -- Color for new pixels, std::vector<double>.
3404  *
3405  * @param sub Sub-image to insert into main image.
3406  * @param x Left edge of sub in main.
3407  * @param y Top edge of sub in main.
3408  * @param options Set of options.
3409  * @return Output image.
3410  */
3411 VImage insert( VImage sub, int x, int y, VOption *options = 0 ) const;
3412 
3413 /**
3414  * Invert an image.
3415  * @param options Set of options.
3416  * @return Output image.
3417  */
3418 VImage invert( VOption *options = 0 ) const;
3419 
3420 /**
3421  * Build an inverted look-up table.
3422  *
3423  * **Optional parameters**
3424  *   - **size** -- LUT size to generate, int.
3425  *
3426  * @param options Set of options.
3427  * @return Output image.
3428  */
3429 VImage invertlut( VOption *options = 0 ) const;
3430 
3431 /**
3432  * Inverse fft.
3433  *
3434  * **Optional parameters**
3435  *   - **real** -- Output only the real part of the transform, bool.
3436  *
3437  * @param options Set of options.
3438  * @return Output image.
3439  */
3440 VImage invfft( VOption *options = 0 ) const;
3441 
3442 /**
3443  * Join a pair of images.
3444  *
3445  * **Optional parameters**
3446  *   - **expand** -- Expand output to hold all of both inputs, bool.
3447  *   - **shim** -- Pixels between images, int.
3448  *   - **background** -- Colour for new pixels, std::vector<double>.
3449  *   - **align** -- Align on the low, centre or high coordinate edge, VipsAlign.
3450  *
3451  * @param in2 Second input image.
3452  * @param direction Join left-right or up-down.
3453  * @param options Set of options.
3454  * @return Output image.
3455  */
3456 VImage join( VImage in2, VipsDirection direction, VOption *options = 0 ) const;
3457 
3458 /**
3459  * Load jpeg2000 image.
3460  *
3461  * **Optional parameters**
3462  *   - **page** -- Load this page from the image, int.
3463  *   - **memory** -- Force open via memory, bool.
3464  *   - **access** -- Required access pattern for this file, VipsAccess.
3465  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3466  *
3467  * @param filename Filename to load from.
3468  * @param options Set of options.
3469  * @return Output image.
3470  */
3471 static VImage jp2kload( const char *filename, VOption *options = 0 );
3472 
3473 /**
3474  * Load jpeg2000 image.
3475  *
3476  * **Optional parameters**
3477  *   - **page** -- Load this page from the image, int.
3478  *   - **memory** -- Force open via memory, bool.
3479  *   - **access** -- Required access pattern for this file, VipsAccess.
3480  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3481  *
3482  * @param buffer Buffer to load from.
3483  * @param options Set of options.
3484  * @return Output image.
3485  */
3486 static VImage jp2kload_buffer( VipsBlob *buffer, VOption *options = 0 );
3487 
3488 /**
3489  * Load jpeg2000 image.
3490  *
3491  * **Optional parameters**
3492  *   - **page** -- Load this page from the image, int.
3493  *   - **memory** -- Force open via memory, bool.
3494  *   - **access** -- Required access pattern for this file, VipsAccess.
3495  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3496  *
3497  * @param source Source to load from.
3498  * @param options Set of options.
3499  * @return Output image.
3500  */
3501 static VImage jp2kload_source( VSource source, VOption *options = 0 );
3502 
3503 /**
3504  * Save image in jpeg2000 format.
3505  *
3506  * **Optional parameters**
3507  *   - **tile_width** -- Tile width in pixels, int.
3508  *   - **tile_height** -- Tile height in pixels, int.
3509  *   - **lossless** -- Enable lossless compression, bool.
3510  *   - **Q** -- Q factor, int.
3511  *   - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample.
3512  *   - **strip** -- Strip all metadata from image, bool.
3513  *   - **background** -- Background value, std::vector<double>.
3514  *   - **page_height** -- Set page height for multipage save, int.
3515  *
3516  * @param filename Filename to load from.
3517  * @param options Set of options.
3518  */
3519 void jp2ksave( const char *filename, VOption *options = 0 ) const;
3520 
3521 /**
3522  * Save image in jpeg2000 format.
3523  *
3524  * **Optional parameters**
3525  *   - **tile_width** -- Tile width in pixels, int.
3526  *   - **tile_height** -- Tile height in pixels, int.
3527  *   - **lossless** -- Enable lossless compression, bool.
3528  *   - **Q** -- Q factor, int.
3529  *   - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample.
3530  *   - **strip** -- Strip all metadata from image, bool.
3531  *   - **background** -- Background value, std::vector<double>.
3532  *   - **page_height** -- Set page height for multipage save, int.
3533  *
3534  * @param options Set of options.
3535  * @return Buffer to save to.
3536  */
3537 VipsBlob *jp2ksave_buffer( VOption *options = 0 ) const;
3538 
3539 /**
3540  * Save image in jpeg2000 format.
3541  *
3542  * **Optional parameters**
3543  *   - **tile_width** -- Tile width in pixels, int.
3544  *   - **tile_height** -- Tile height in pixels, int.
3545  *   - **lossless** -- Enable lossless compression, bool.
3546  *   - **Q** -- Q factor, int.
3547  *   - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample.
3548  *   - **strip** -- Strip all metadata from image, bool.
3549  *   - **background** -- Background value, std::vector<double>.
3550  *   - **page_height** -- Set page height for multipage save, int.
3551  *
3552  * @param target Target to save to.
3553  * @param options Set of options.
3554  */
3555 void jp2ksave_target( VTarget target, VOption *options = 0 ) const;
3556 
3557 /**
3558  * Load jpeg from file.
3559  *
3560  * **Optional parameters**
3561  *   - **shrink** -- Shrink factor on load, int.
3562  *   - **autorotate** -- Rotate image using exif orientation, bool.
3563  *   - **memory** -- Force open via memory, bool.
3564  *   - **access** -- Required access pattern for this file, VipsAccess.
3565  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3566  *
3567  * @param filename Filename to load from.
3568  * @param options Set of options.
3569  * @return Output image.
3570  */
3571 static VImage jpegload( const char *filename, VOption *options = 0 );
3572 
3573 /**
3574  * Load jpeg from buffer.
3575  *
3576  * **Optional parameters**
3577  *   - **shrink** -- Shrink factor on load, int.
3578  *   - **autorotate** -- Rotate image using exif orientation, bool.
3579  *   - **memory** -- Force open via memory, bool.
3580  *   - **access** -- Required access pattern for this file, VipsAccess.
3581  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3582  *
3583  * @param buffer Buffer to load from.
3584  * @param options Set of options.
3585  * @return Output image.
3586  */
3587 static VImage jpegload_buffer( VipsBlob *buffer, VOption *options = 0 );
3588 
3589 /**
3590  * Load image from jpeg source.
3591  *
3592  * **Optional parameters**
3593  *   - **shrink** -- Shrink factor on load, int.
3594  *   - **autorotate** -- Rotate image using exif orientation, bool.
3595  *   - **memory** -- Force open via memory, bool.
3596  *   - **access** -- Required access pattern for this file, VipsAccess.
3597  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3598  *
3599  * @param source Source to load from.
3600  * @param options Set of options.
3601  * @return Output image.
3602  */
3603 static VImage jpegload_source( VSource source, VOption *options = 0 );
3604 
3605 /**
3606  * Save image to jpeg file.
3607  *
3608  * **Optional parameters**
3609  *   - **Q** -- Q factor, int.
3610  *   - **profile** -- ICC profile to embed, const char *.
3611  *   - **optimize_coding** -- Compute optimal Huffman coding tables, bool.
3612  *   - **interlace** -- Generate an interlaced (progressive) jpeg, bool.
3613  *   - **trellis_quant** -- Apply trellis quantisation to each 8x8 block, bool.
3614  *   - **overshoot_deringing** -- Apply overshooting to samples with extreme values, bool.
3615  *   - **optimize_scans** -- Split spectrum of DCT coefficients into separate scans, bool.
3616  *   - **quant_table** -- Use predefined quantization table with given index, int.
3617  *   - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample.
3618  *   - **restart_interval** -- Add restart markers every specified number of mcu, int.
3619  *   - **strip** -- Strip all metadata from image, bool.
3620  *   - **background** -- Background value, std::vector<double>.
3621  *   - **page_height** -- Set page height for multipage save, int.
3622  *
3623  * @param filename Filename to save to.
3624  * @param options Set of options.
3625  */
3626 void jpegsave( const char *filename, VOption *options = 0 ) const;
3627 
3628 /**
3629  * Save image to jpeg buffer.
3630  *
3631  * **Optional parameters**
3632  *   - **Q** -- Q factor, int.
3633  *   - **profile** -- ICC profile to embed, const char *.
3634  *   - **optimize_coding** -- Compute optimal Huffman coding tables, bool.
3635  *   - **interlace** -- Generate an interlaced (progressive) jpeg, bool.
3636  *   - **trellis_quant** -- Apply trellis quantisation to each 8x8 block, bool.
3637  *   - **overshoot_deringing** -- Apply overshooting to samples with extreme values, bool.
3638  *   - **optimize_scans** -- Split spectrum of DCT coefficients into separate scans, bool.
3639  *   - **quant_table** -- Use predefined quantization table with given index, int.
3640  *   - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample.
3641  *   - **restart_interval** -- Add restart markers every specified number of mcu, int.
3642  *   - **strip** -- Strip all metadata from image, bool.
3643  *   - **background** -- Background value, std::vector<double>.
3644  *   - **page_height** -- Set page height for multipage save, int.
3645  *
3646  * @param options Set of options.
3647  * @return Buffer to save to.
3648  */
3649 VipsBlob *jpegsave_buffer( VOption *options = 0 ) const;
3650 
3651 /**
3652  * Save image to jpeg mime.
3653  *
3654  * **Optional parameters**
3655  *   - **Q** -- Q factor, int.
3656  *   - **profile** -- ICC profile to embed, const char *.
3657  *   - **optimize_coding** -- Compute optimal Huffman coding tables, bool.
3658  *   - **interlace** -- Generate an interlaced (progressive) jpeg, bool.
3659  *   - **trellis_quant** -- Apply trellis quantisation to each 8x8 block, bool.
3660  *   - **overshoot_deringing** -- Apply overshooting to samples with extreme values, bool.
3661  *   - **optimize_scans** -- Split spectrum of DCT coefficients into separate scans, bool.
3662  *   - **quant_table** -- Use predefined quantization table with given index, int.
3663  *   - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample.
3664  *   - **restart_interval** -- Add restart markers every specified number of mcu, int.
3665  *   - **strip** -- Strip all metadata from image, bool.
3666  *   - **background** -- Background value, std::vector<double>.
3667  *   - **page_height** -- Set page height for multipage save, int.
3668  *
3669  * @param options Set of options.
3670  */
3671 void jpegsave_mime( VOption *options = 0 ) const;
3672 
3673 /**
3674  * Save image to jpeg target.
3675  *
3676  * **Optional parameters**
3677  *   - **Q** -- Q factor, int.
3678  *   - **profile** -- ICC profile to embed, const char *.
3679  *   - **optimize_coding** -- Compute optimal Huffman coding tables, bool.
3680  *   - **interlace** -- Generate an interlaced (progressive) jpeg, bool.
3681  *   - **trellis_quant** -- Apply trellis quantisation to each 8x8 block, bool.
3682  *   - **overshoot_deringing** -- Apply overshooting to samples with extreme values, bool.
3683  *   - **optimize_scans** -- Split spectrum of DCT coefficients into separate scans, bool.
3684  *   - **quant_table** -- Use predefined quantization table with given index, int.
3685  *   - **subsample_mode** -- Select chroma subsample operation mode, VipsForeignSubsample.
3686  *   - **restart_interval** -- Add restart markers every specified number of mcu, int.
3687  *   - **strip** -- Strip all metadata from image, bool.
3688  *   - **background** -- Background value, std::vector<double>.
3689  *   - **page_height** -- Set page height for multipage save, int.
3690  *
3691  * @param target Target to save to.
3692  * @param options Set of options.
3693  */
3694 void jpegsave_target( VTarget target, VOption *options = 0 ) const;
3695 
3696 /**
3697  * Load jpeg-xl image.
3698  *
3699  * **Optional parameters**
3700  *   - **memory** -- Force open via memory, bool.
3701  *   - **access** -- Required access pattern for this file, VipsAccess.
3702  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3703  *
3704  * @param filename Filename to load from.
3705  * @param options Set of options.
3706  * @return Output image.
3707  */
3708 static VImage jxlload( const char *filename, VOption *options = 0 );
3709 
3710 /**
3711  * Load jpeg-xl image.
3712  *
3713  * **Optional parameters**
3714  *   - **memory** -- Force open via memory, bool.
3715  *   - **access** -- Required access pattern for this file, VipsAccess.
3716  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3717  *
3718  * @param buffer Buffer to load from.
3719  * @param options Set of options.
3720  * @return Output image.
3721  */
3722 static VImage jxlload_buffer( VipsBlob *buffer, VOption *options = 0 );
3723 
3724 /**
3725  * Load jpeg-xl image.
3726  *
3727  * **Optional parameters**
3728  *   - **memory** -- Force open via memory, bool.
3729  *   - **access** -- Required access pattern for this file, VipsAccess.
3730  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3731  *
3732  * @param source Source to load from.
3733  * @param options Set of options.
3734  * @return Output image.
3735  */
3736 static VImage jxlload_source( VSource source, VOption *options = 0 );
3737 
3738 /**
3739  * Save image in jpeg-xl format.
3740  *
3741  * **Optional parameters**
3742  *   - **tier** -- Decode speed tier, int.
3743  *   - **distance** -- Target butteraugli distance, double.
3744  *   - **effort** -- Encoding effort, int.
3745  *   - **lossless** -- Enable lossless compression, bool.
3746  *   - **Q** -- Quality factor, int.
3747  *   - **strip** -- Strip all metadata from image, bool.
3748  *   - **background** -- Background value, std::vector<double>.
3749  *   - **page_height** -- Set page height for multipage save, int.
3750  *
3751  * @param filename Filename to load from.
3752  * @param options Set of options.
3753  */
3754 void jxlsave( const char *filename, VOption *options = 0 ) const;
3755 
3756 /**
3757  * Save image in jpeg-xl format.
3758  *
3759  * **Optional parameters**
3760  *   - **tier** -- Decode speed tier, int.
3761  *   - **distance** -- Target butteraugli distance, double.
3762  *   - **effort** -- Encoding effort, int.
3763  *   - **lossless** -- Enable lossless compression, bool.
3764  *   - **Q** -- Quality factor, int.
3765  *   - **strip** -- Strip all metadata from image, bool.
3766  *   - **background** -- Background value, std::vector<double>.
3767  *   - **page_height** -- Set page height for multipage save, int.
3768  *
3769  * @param options Set of options.
3770  * @return Buffer to save to.
3771  */
3772 VipsBlob *jxlsave_buffer( VOption *options = 0 ) const;
3773 
3774 /**
3775  * Save image in jpeg-xl format.
3776  *
3777  * **Optional parameters**
3778  *   - **tier** -- Decode speed tier, int.
3779  *   - **distance** -- Target butteraugli distance, double.
3780  *   - **effort** -- Encoding effort, int.
3781  *   - **lossless** -- Enable lossless compression, bool.
3782  *   - **Q** -- Quality factor, int.
3783  *   - **strip** -- Strip all metadata from image, bool.
3784  *   - **background** -- Background value, std::vector<double>.
3785  *   - **page_height** -- Set page height for multipage save, int.
3786  *
3787  * @param target Target to save to.
3788  * @param options Set of options.
3789  */
3790 void jxlsave_target( VTarget target, VOption *options = 0 ) const;
3791 
3792 /**
3793  * Label regions in an image.
3794  * @param options Set of options.
3795  * @return Mask of region labels.
3796  */
3797 VImage labelregions( VOption *options = 0 ) const;
3798 
3799 /**
3800  * Calculate (a * in + b).
3801  *
3802  * **Optional parameters**
3803  *   - **uchar** -- Output should be uchar, bool.
3804  *
3805  * @param a Multiply by this.
3806  * @param b Add this.
3807  * @param options Set of options.
3808  * @return Output image.
3809  */
3810 VImage linear( std::vector<double> a, std::vector<double> b, VOption *options = 0 ) const;
3811 
3812 /**
3813  * Cache an image as a set of lines.
3814  *
3815  * **Optional parameters**
3816  *   - **tile_height** -- Tile height in pixels, int.
3817  *   - **access** -- Expected access pattern, VipsAccess.
3818  *   - **threaded** -- Allow threaded access, bool.
3819  *   - **persistent** -- Keep cache between evaluations, bool.
3820  *
3821  * @param options Set of options.
3822  * @return Output image.
3823  */
3824 VImage linecache( VOption *options = 0 ) const;
3825 
3826 /**
3827  * Make a laplacian of gaussian image.
3828  *
3829  * **Optional parameters**
3830  *   - **separable** -- Generate separable Logmatian, bool.
3831  *   - **precision** -- Generate with this precision, VipsPrecision.
3832  *
3833  * @param sigma Radius of Logmatian.
3834  * @param min_ampl Minimum amplitude of Logmatian.
3835  * @param options Set of options.
3836  * @return Output image.
3837  */
3838 static VImage logmat( double sigma, double min_ampl, VOption *options = 0 );
3839 
3840 /**
3841  * Load file with imagemagick.
3842  *
3843  * **Optional parameters**
3844  *   - **density** -- Canvas resolution for rendering vector formats like SVG, const char *.
3845  *   - **page** -- Load this page from the file, int.
3846  *   - **n** -- Load this many pages, int.
3847  *   - **memory** -- Force open via memory, bool.
3848  *   - **access** -- Required access pattern for this file, VipsAccess.
3849  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3850  *
3851  * @param filename Filename to load from.
3852  * @param options Set of options.
3853  * @return Output image.
3854  */
3855 static VImage magickload( const char *filename, VOption *options = 0 );
3856 
3857 /**
3858  * Load buffer with imagemagick.
3859  *
3860  * **Optional parameters**
3861  *   - **density** -- Canvas resolution for rendering vector formats like SVG, const char *.
3862  *   - **page** -- Load this page from the file, int.
3863  *   - **n** -- Load this many pages, int.
3864  *   - **memory** -- Force open via memory, bool.
3865  *   - **access** -- Required access pattern for this file, VipsAccess.
3866  *   - **fail_on** -- Error level to fail on, VipsFailOn.
3867  *
3868  * @param buffer Buffer to load from.
3869  * @param options Set of options.
3870  * @return Output image.
3871  */
3872 static VImage magickload_buffer( VipsBlob *buffer, VOption *options = 0 );
3873 
3874 /**
3875  * Save file with imagemagick.
3876  *
3877  * **Optional parameters**
3878  *   - **format** -- Format to save in, const char *.
3879  *   - **quality** -- Quality to use, int.
3880  *   - **optimize_gif_frames** -- Apply GIF frames optimization, bool.
3881  *   - **optimize_gif_transparency** -- Apply GIF transparency optimization, bool.
3882  *   - **strip** -- Strip all metadata from image, bool.
3883  *   - **background** -- Background value, std::vector<double>.
3884  *   - **page_height** -- Set page height for multipage save, int.
3885  *
3886  * @param filename Filename to save to.
3887  * @param options Set of options.
3888  */
3889 void magicksave( const char *filename, VOption *options = 0 ) const;
3890 
3891 /**
3892  * Save image to magick buffer.
3893  *
3894  * **Optional parameters**
3895  *   - **format** -- Format to save in, const char *.
3896  *   - **quality** -- Quality to use, int.
3897  *   - **optimize_gif_frames** -- Apply GIF frames optimization, bool.
3898  *   - **optimize_gif_transparency** -- Apply GIF transparency optimization, bool.
3899  *   - **strip** -- Strip all metadata from image, bool.
3900  *   - **background** -- Background value, std::vector<double>.
3901  *   - **page_height** -- Set page height for multipage save, int.
3902  *
3903  * @param options Set of options.
3904  * @return Buffer to save to.
3905  */
3906 VipsBlob *magicksave_buffer( VOption *options = 0 ) const;
3907 
3908 /**
3909  * Resample with a map image.
3910  *
3911  * **Optional parameters**
3912  *   - **interpolate** -- Interpolate pixels with this, VInterpolate.
3913  *
3914  * @param index Index pixels with this.
3915  * @param options Set of options.
3916  * @return Output image.
3917  */
3918 VImage mapim( VImage index, VOption *options = 0 ) const;
3919 
3920 /**
3921  * Map an image though a lut.
3922  *
3923  * **Optional parameters**
3924  *   - **band** -- apply one-band lut to this band of in, int.
3925  *
3926  * @param lut Look-up table image.
3927  * @param options Set of options.
3928  * @return Output image.
3929  */
3930 VImage maplut( VImage lut, VOption *options = 0 ) const;
3931 
3932 /**
3933  * Make a butterworth filter.
3934  *
3935  * **Optional parameters**
3936  *   - **uchar** -- Output an unsigned char image, bool.
3937  *   - **nodc** -- Remove DC component, bool.
3938  *   - **reject** -- Invert the sense of the filter, bool.
3939  *   - **optical** -- Rotate quadrants to optical space, bool.
3940  *
3941  * @param width Image width in pixels.
3942  * @param height Image height in pixels.
3943  * @param order Filter order.
3944  * @param frequency_cutoff Frequency cutoff.
3945  * @param amplitude_cutoff Amplitude cutoff.
3946  * @param options Set of options.
3947  * @return Output image.
3948  */
3949 static VImage mask_butterworth( int width, int height, double order, double frequency_cutoff, double amplitude_cutoff, VOption *options = 0 );
3950 
3951 /**
3952  * Make a butterworth_band filter.
3953  *
3954  * **Optional parameters**
3955  *   - **uchar** -- Output an unsigned char image, bool.
3956  *   - **nodc** -- Remove DC component, bool.
3957  *   - **reject** -- Invert the sense of the filter, bool.
3958  *   - **optical** -- Rotate quadrants to optical space, bool.
3959  *
3960  * @param width Image width in pixels.
3961  * @param height Image height in pixels.
3962  * @param order Filter order.
3963  * @param frequency_cutoff_x Frequency cutoff x.
3964  * @param frequency_cutoff_y Frequency cutoff y.
3965  * @param radius radius of circle.
3966  * @param amplitude_cutoff Amplitude cutoff.
3967  * @param options Set of options.
3968  * @return Output image.
3969  */
3970 static VImage mask_butterworth_band( int width, int height, double order, double frequency_cutoff_x, double frequency_cutoff_y, double radius, double amplitude_cutoff, VOption *options = 0 );
3971 
3972 /**
3973  * Make a butterworth ring filter.
3974  *
3975  * **Optional parameters**
3976  *   - **uchar** -- Output an unsigned char image, bool.
3977  *   - **nodc** -- Remove DC component, bool.
3978  *   - **reject** -- Invert the sense of the filter, bool.
3979  *   - **optical** -- Rotate quadrants to optical space, bool.
3980  *
3981  * @param width Image width in pixels.
3982  * @param height Image height in pixels.
3983  * @param order Filter order.
3984  * @param frequency_cutoff Frequency cutoff.
3985  * @param amplitude_cutoff Amplitude cutoff.
3986  * @param ringwidth Ringwidth.
3987  * @param options Set of options.
3988  * @return Output image.
3989  */
3990 static VImage mask_butterworth_ring( int width, int height, double order, double frequency_cutoff, double amplitude_cutoff, double ringwidth, VOption *options = 0 );
3991 
3992 /**
3993  * Make fractal filter.
3994  *
3995  * **Optional parameters**
3996  *   - **uchar** -- Output an unsigned char image, bool.
3997  *   - **nodc** -- Remove DC component, bool.
3998  *   - **reject** -- Invert the sense of the filter, bool.
3999  *   - **optical** -- Rotate quadrants to optical space, bool.
4000  *
4001  * @param width Image width in pixels.
4002  * @param height Image height in pixels.
4003  * @param fractal_dimension Fractal dimension.
4004  * @param options Set of options.
4005  * @return Output image.
4006  */
4007 static VImage mask_fractal( int width, int height, double fractal_dimension, VOption *options = 0 );
4008 
4009 /**
4010  * Make a gaussian filter.
4011  *
4012  * **Optional parameters**
4013  *   - **uchar** -- Output an unsigned char image, bool.
4014  *   - **nodc** -- Remove DC component, bool.
4015  *   - **reject** -- Invert the sense of the filter, bool.
4016  *   - **optical** -- Rotate quadrants to optical space, bool.
4017  *
4018  * @param width Image width in pixels.
4019  * @param height Image height in pixels.
4020  * @param frequency_cutoff Frequency cutoff.
4021  * @param amplitude_cutoff Amplitude cutoff.
4022  * @param options Set of options.
4023  * @return Output image.
4024  */
4025 static VImage mask_gaussian( int width, int height, double frequency_cutoff, double amplitude_cutoff, VOption *options = 0 );
4026 
4027 /**
4028  * Make a gaussian filter.
4029  *
4030  * **Optional parameters**
4031  *   - **uchar** -- Output an unsigned char image, bool.
4032  *   - **nodc** -- Remove DC component, bool.
4033  *   - **reject** -- Invert the sense of the filter, bool.
4034  *   - **optical** -- Rotate quadrants to optical space, bool.
4035  *
4036  * @param width Image width in pixels.
4037  * @param height Image height in pixels.
4038  * @param frequency_cutoff_x Frequency cutoff x.
4039  * @param frequency_cutoff_y Frequency cutoff y.
4040  * @param radius radius of circle.
4041  * @param amplitude_cutoff Amplitude cutoff.
4042  * @param options Set of options.
4043  * @return Output image.
4044  */
4045 static VImage mask_gaussian_band( int width, int height, double frequency_cutoff_x, double frequency_cutoff_y, double radius, double amplitude_cutoff, VOption *options = 0 );
4046 
4047 /**
4048  * Make a gaussian ring filter.
4049  *
4050  * **Optional parameters**
4051  *   - **uchar** -- Output an unsigned char image, bool.
4052  *   - **nodc** -- Remove DC component, bool.
4053  *   - **reject** -- Invert the sense of the filter, bool.
4054  *   - **optical** -- Rotate quadrants to optical space, bool.
4055  *
4056  * @param width Image width in pixels.
4057  * @param height Image height in pixels.
4058  * @param frequency_cutoff Frequency cutoff.
4059  * @param amplitude_cutoff Amplitude cutoff.
4060  * @param ringwidth Ringwidth.
4061  * @param options Set of options.
4062  * @return Output image.
4063  */
4064 static VImage mask_gaussian_ring( int width, int height, double frequency_cutoff, double amplitude_cutoff, double ringwidth, VOption *options = 0 );
4065 
4066 /**
4067  * Make an ideal filter.
4068  *
4069  * **Optional parameters**
4070  *   - **uchar** -- Output an unsigned char image, bool.
4071  *   - **nodc** -- Remove DC component, bool.
4072  *   - **reject** -- Invert the sense of the filter, bool.
4073  *   - **optical** -- Rotate quadrants to optical space, bool.
4074  *
4075  * @param width Image width in pixels.
4076  * @param height Image height in pixels.
4077  * @param frequency_cutoff Frequency cutoff.
4078  * @param options Set of options.
4079  * @return Output image.
4080  */
4081 static VImage mask_ideal( int width, int height, double frequency_cutoff, VOption *options = 0 );
4082 
4083 /**
4084  * Make an ideal band filter.
4085  *
4086  * **Optional parameters**
4087  *   - **uchar** -- Output an unsigned char image, bool.
4088  *   - **nodc** -- Remove DC component, bool.
4089  *   - **reject** -- Invert the sense of the filter, bool.
4090  *   - **optical** -- Rotate quadrants to optical space, bool.
4091  *
4092  * @param width Image width in pixels.
4093  * @param height Image height in pixels.
4094  * @param frequency_cutoff_x Frequency cutoff x.
4095  * @param frequency_cutoff_y Frequency cutoff y.
4096  * @param radius radius of circle.
4097  * @param options Set of options.
4098  * @return Output image.
4099  */
4100 static VImage mask_ideal_band( int width, int height, double frequency_cutoff_x, double frequency_cutoff_y, double radius, VOption *options = 0 );
4101 
4102 /**
4103  * Make an ideal ring filter.
4104  *
4105  * **Optional parameters**
4106  *   - **uchar** -- Output an unsigned char image, bool.
4107  *   - **nodc** -- Remove DC component, bool.
4108  *   - **reject** -- Invert the sense of the filter, bool.
4109  *   - **optical** -- Rotate quadrants to optical space, bool.
4110  *
4111  * @param width Image width in pixels.
4112  * @param height Image height in pixels.
4113  * @param frequency_cutoff Frequency cutoff.
4114  * @param ringwidth Ringwidth.
4115  * @param options Set of options.
4116  * @return Output image.
4117  */
4118 static VImage mask_ideal_ring( int width, int height, double frequency_cutoff, double ringwidth, VOption *options = 0 );
4119 
4120 /**
4121  * First-order match of two images.
4122  *
4123  * **Optional parameters**
4124  *   - **hwindow** -- Half window size, int.
4125  *   - **harea** -- Half area size, int.
4126  *   - **search** -- Search to improve tie-points, bool.
4127  *   - **interpolate** -- Interpolate pixels with this, VInterpolate.
4128  *
4129  * @param sec Secondary image.
4130  * @param xr1 Position of first reference tie-point.
4131  * @param yr1 Position of first reference tie-point.
4132  * @param xs1 Position of first secondary tie-point.
4133  * @param ys1 Position of first secondary tie-point.
4134  * @param xr2 Position of second reference tie-point.
4135  * @param yr2 Position of second reference tie-point.
4136  * @param xs2 Position of second secondary tie-point.
4137  * @param ys2 Position of second secondary tie-point.
4138  * @param options Set of options.
4139  * @return Output image.
4140  */
4141 VImage match( VImage sec, int xr1, int yr1, int xs1, int ys1, int xr2, int yr2, int xs2, int ys2, VOption *options = 0 ) const;
4142 
4143 /**
4144  * Apply a math operation to an image.
4145  * @param math math to perform.
4146  * @param options Set of options.
4147  * @return Output image.
4148  */
4149 VImage math( VipsOperationMath math, VOption *options = 0 ) const;
4150 
4151 /**
4152  * Binary math operations.
4153  * @param right Right-hand image argument.
4154  * @param math2 math to perform.
4155  * @param options Set of options.
4156  * @return Output image.
4157  */
4158 VImage math2( VImage right, VipsOperationMath2 math2, VOption *options = 0 ) const;
4159 
4160 /**
4161  * Binary math operations with a constant.
4162  * @param math2 math to perform.
4163  * @param c Array of constants.
4164  * @param options Set of options.
4165  * @return Output image.
4166  */
4167 VImage math2_const( VipsOperationMath2 math2, std::vector<double> c, VOption *options = 0 ) const;
4168 
4169 /**
4170  * Load mat from file.
4171  *
4172  * **Optional parameters**
4173  *   - **memory** -- Force open via memory, bool.
4174  *   - **access** -- Required access pattern for this file, VipsAccess.
4175  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4176  *
4177  * @param filename Filename to load from.
4178  * @param options Set of options.
4179  * @return Output image.
4180  */
4181 static VImage matload( const char *filename, VOption *options = 0 );
4182 
4183 /**
4184  * Invert an matrix.
4185  * @param options Set of options.
4186  * @return Output matrix.
4187  */
4188 VImage matrixinvert( VOption *options = 0 ) const;
4189 
4190 /**
4191  * Load matrix.
4192  *
4193  * **Optional parameters**
4194  *   - **memory** -- Force open via memory, bool.
4195  *   - **access** -- Required access pattern for this file, VipsAccess.
4196  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4197  *
4198  * @param filename Filename to load from.
4199  * @param options Set of options.
4200  * @return Output image.
4201  */
4202 static VImage matrixload( const char *filename, VOption *options = 0 );
4203 
4204 /**
4205  * Load matrix.
4206  *
4207  * **Optional parameters**
4208  *   - **memory** -- Force open via memory, bool.
4209  *   - **access** -- Required access pattern for this file, VipsAccess.
4210  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4211  *
4212  * @param source Source to load from.
4213  * @param options Set of options.
4214  * @return Output image.
4215  */
4216 static VImage matrixload_source( VSource source, VOption *options = 0 );
4217 
4218 /**
4219  * Print matrix.
4220  *
4221  * **Optional parameters**
4222  *   - **strip** -- Strip all metadata from image, bool.
4223  *   - **background** -- Background value, std::vector<double>.
4224  *   - **page_height** -- Set page height for multipage save, int.
4225  *
4226  * @param options Set of options.
4227  */
4228 void matrixprint( VOption *options = 0 ) const;
4229 
4230 /**
4231  * Save image to matrix.
4232  *
4233  * **Optional parameters**
4234  *   - **strip** -- Strip all metadata from image, bool.
4235  *   - **background** -- Background value, std::vector<double>.
4236  *   - **page_height** -- Set page height for multipage save, int.
4237  *
4238  * @param filename Filename to save to.
4239  * @param options Set of options.
4240  */
4241 void matrixsave( const char *filename, VOption *options = 0 ) const;
4242 
4243 /**
4244  * Save image to matrix.
4245  *
4246  * **Optional parameters**
4247  *   - **strip** -- Strip all metadata from image, bool.
4248  *   - **background** -- Background value, std::vector<double>.
4249  *   - **page_height** -- Set page height for multipage save, int.
4250  *
4251  * @param target Target to save to.
4252  * @param options Set of options.
4253  */
4254 void matrixsave_target( VTarget target, VOption *options = 0 ) const;
4255 
4256 /**
4257  * Find image maximum.
4258  *
4259  * **Optional parameters**
4260  *   - **size** -- Number of maximum values to find, int.
4261  *
4262  * @param options Set of options.
4263  * @return Output value.
4264  */
4265 double max( VOption *options = 0 ) const;
4266 
4267 /**
4268  * Measure a set of patches on a color chart.
4269  *
4270  * **Optional parameters**
4271  *   - **left** -- Left edge of extract area, int.
4272  *   - **top** -- Top edge of extract area, int.
4273  *   - **width** -- Width of extract area, int.
4274  *   - **height** -- Height of extract area, int.
4275  *
4276  * @param h Number of patches across chart.
4277  * @param v Number of patches down chart.
4278  * @param options Set of options.
4279  * @return Output array of statistics.
4280  */
4281 VImage measure( int h, int v, VOption *options = 0 ) const;
4282 
4283 /**
4284  * Merge two images.
4285  *
4286  * **Optional parameters**
4287  *   - **mblend** -- Maximum blend size, int.
4288  *
4289  * @param sec Secondary image.
4290  * @param direction Horizontal or vertical merge.
4291  * @param dx Horizontal displacement from sec to ref.
4292  * @param dy Vertical displacement from sec to ref.
4293  * @param options Set of options.
4294  * @return Output image.
4295  */
4296 VImage merge( VImage sec, VipsDirection direction, int dx, int dy, VOption *options = 0 ) const;
4297 
4298 /**
4299  * Find image minimum.
4300  *
4301  * **Optional parameters**
4302  *   - **size** -- Number of minimum values to find, int.
4303  *
4304  * @param options Set of options.
4305  * @return Output value.
4306  */
4307 double min( VOption *options = 0 ) const;
4308 
4309 /**
4310  * Morphology operation.
4311  * @param mask Input matrix image.
4312  * @param morph Morphological operation to perform.
4313  * @param options Set of options.
4314  * @return Output image.
4315  */
4316 VImage morph( VImage mask, VipsOperationMorphology morph, VOption *options = 0 ) const;
4317 
4318 /**
4319  * Mosaic two images.
4320  *
4321  * **Optional parameters**
4322  *   - **hwindow** -- Half window size, int.
4323  *   - **harea** -- Half area size, int.
4324  *   - **mblend** -- Maximum blend size, int.
4325  *   - **bandno** -- Band to search for features on, int.
4326  *
4327  * @param sec Secondary image.
4328  * @param direction Horizontal or vertical mosaic.
4329  * @param xref Position of reference tie-point.
4330  * @param yref Position of reference tie-point.
4331  * @param xsec Position of secondary tie-point.
4332  * @param ysec Position of secondary tie-point.
4333  * @param options Set of options.
4334  * @return Output image.
4335  */
4336 VImage mosaic( VImage sec, VipsDirection direction, int xref, int yref, int xsec, int ysec, VOption *options = 0 ) const;
4337 
4338 /**
4339  * First-order mosaic of two images.
4340  *
4341  * **Optional parameters**
4342  *   - **hwindow** -- Half window size, int.
4343  *   - **harea** -- Half area size, int.
4344  *   - **search** -- Search to improve tie-points, bool.
4345  *   - **interpolate** -- Interpolate pixels with this, VInterpolate.
4346  *   - **mblend** -- Maximum blend size, int.
4347  *   - **bandno** -- Band to search for features on, int.
4348  *
4349  * @param sec Secondary image.
4350  * @param direction Horizontal or vertical mosaic.
4351  * @param xr1 Position of first reference tie-point.
4352  * @param yr1 Position of first reference tie-point.
4353  * @param xs1 Position of first secondary tie-point.
4354  * @param ys1 Position of first secondary tie-point.
4355  * @param xr2 Position of second reference tie-point.
4356  * @param yr2 Position of second reference tie-point.
4357  * @param xs2 Position of second secondary tie-point.
4358  * @param ys2 Position of second secondary tie-point.
4359  * @param options Set of options.
4360  * @return Output image.
4361  */
4362 VImage mosaic1( VImage sec, VipsDirection direction, int xr1, int yr1, int xs1, int ys1, int xr2, int yr2, int xs2, int ys2, VOption *options = 0 ) const;
4363 
4364 /**
4365  * Pick most-significant byte from an image.
4366  *
4367  * **Optional parameters**
4368  *   - **band** -- Band to msb, int.
4369  *
4370  * @param options Set of options.
4371  * @return Output image.
4372  */
4373 VImage msb( VOption *options = 0 ) const;
4374 
4375 /**
4376  * Multiply two images.
4377  * @param right Right-hand image argument.
4378  * @param options Set of options.
4379  * @return Output image.
4380  */
4381 VImage multiply( VImage right, VOption *options = 0 ) const;
4382 
4383 /**
4384  * Load nifti volume.
4385  *
4386  * **Optional parameters**
4387  *   - **memory** -- Force open via memory, bool.
4388  *   - **access** -- Required access pattern for this file, VipsAccess.
4389  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4390  *
4391  * @param filename Filename to load from.
4392  * @param options Set of options.
4393  * @return Output image.
4394  */
4395 static VImage niftiload( const char *filename, VOption *options = 0 );
4396 
4397 /**
4398  * Load nifti volumes.
4399  *
4400  * **Optional parameters**
4401  *   - **memory** -- Force open via memory, bool.
4402  *   - **access** -- Required access pattern for this file, VipsAccess.
4403  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4404  *
4405  * @param source Source to load from.
4406  * @param options Set of options.
4407  * @return Output image.
4408  */
4409 static VImage niftiload_source( VSource source, VOption *options = 0 );
4410 
4411 /**
4412  * Save image to nifti file.
4413  *
4414  * **Optional parameters**
4415  *   - **strip** -- Strip all metadata from image, bool.
4416  *   - **background** -- Background value, std::vector<double>.
4417  *   - **page_height** -- Set page height for multipage save, int.
4418  *
4419  * @param filename Filename to save to.
4420  * @param options Set of options.
4421  */
4422 void niftisave( const char *filename, VOption *options = 0 ) const;
4423 
4424 /**
4425  * Load an openexr image.
4426  *
4427  * **Optional parameters**
4428  *   - **memory** -- Force open via memory, bool.
4429  *   - **access** -- Required access pattern for this file, VipsAccess.
4430  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4431  *
4432  * @param filename Filename to load from.
4433  * @param options Set of options.
4434  * @return Output image.
4435  */
4436 static VImage openexrload( const char *filename, VOption *options = 0 );
4437 
4438 /**
4439  * Load file with openslide.
4440  *
4441  * **Optional parameters**
4442  *   - **attach_associated** -- Attach all associated images, bool.
4443  *   - **level** -- Load this level from the file, int.
4444  *   - **autocrop** -- Crop to image bounds, bool.
4445  *   - **associated** -- Load this associated image, const char *.
4446  *   - **memory** -- Force open via memory, bool.
4447  *   - **access** -- Required access pattern for this file, VipsAccess.
4448  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4449  *
4450  * @param filename Filename to load from.
4451  * @param options Set of options.
4452  * @return Output image.
4453  */
4454 static VImage openslideload( const char *filename, VOption *options = 0 );
4455 
4456 /**
4457  * Load source with openslide.
4458  *
4459  * **Optional parameters**
4460  *   - **attach_associated** -- Attach all associated images, bool.
4461  *   - **level** -- Load this level from the file, int.
4462  *   - **autocrop** -- Crop to image bounds, bool.
4463  *   - **associated** -- Load this associated image, const char *.
4464  *   - **memory** -- Force open via memory, bool.
4465  *   - **access** -- Required access pattern for this file, VipsAccess.
4466  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4467  *
4468  * @param source Source to load from.
4469  * @param options Set of options.
4470  * @return Output image.
4471  */
4472 static VImage openslideload_source( VSource source, VOption *options = 0 );
4473 
4474 /**
4475  * Load pdf from file.
4476  *
4477  * **Optional parameters**
4478  *   - **page** -- Load this page from the file, int.
4479  *   - **n** -- Load this many pages, int.
4480  *   - **dpi** -- Render at this DPI, double.
4481  *   - **scale** -- Scale output by this factor, double.
4482  *   - **background** -- Background value, std::vector<double>.
4483  *   - **memory** -- Force open via memory, bool.
4484  *   - **access** -- Required access pattern for this file, VipsAccess.
4485  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4486  *
4487  * @param filename Filename to load from.
4488  * @param options Set of options.
4489  * @return Output image.
4490  */
4491 static VImage pdfload( const char *filename, VOption *options = 0 );
4492 
4493 /**
4494  * Load pdf from buffer.
4495  *
4496  * **Optional parameters**
4497  *   - **page** -- Load this page from the file, int.
4498  *   - **n** -- Load this many pages, int.
4499  *   - **dpi** -- Render at this DPI, double.
4500  *   - **scale** -- Scale output by this factor, double.
4501  *   - **background** -- Background value, std::vector<double>.
4502  *   - **memory** -- Force open via memory, bool.
4503  *   - **access** -- Required access pattern for this file, VipsAccess.
4504  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4505  *
4506  * @param buffer Buffer to load from.
4507  * @param options Set of options.
4508  * @return Output image.
4509  */
4510 static VImage pdfload_buffer( VipsBlob *buffer, VOption *options = 0 );
4511 
4512 /**
4513  * Load pdf from source.
4514  *
4515  * **Optional parameters**
4516  *   - **page** -- Load this page from the file, int.
4517  *   - **n** -- Load this many pages, int.
4518  *   - **dpi** -- Render at this DPI, double.
4519  *   - **scale** -- Scale output by this factor, double.
4520  *   - **background** -- Background value, std::vector<double>.
4521  *   - **memory** -- Force open via memory, bool.
4522  *   - **access** -- Required access pattern for this file, VipsAccess.
4523  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4524  *
4525  * @param source Source to load from.
4526  * @param options Set of options.
4527  * @return Output image.
4528  */
4529 static VImage pdfload_source( VSource source, VOption *options = 0 );
4530 
4531 /**
4532  * Find threshold for percent of pixels.
4533  * @param percent Percent of pixels.
4534  * @param options Set of options.
4535  * @return Threshold above which lie percent of pixels.
4536  */
4537 int percent( double percent, VOption *options = 0 ) const;
4538 
4539 /**
4540  * Make a perlin noise image.
4541  *
4542  * **Optional parameters**
4543  *   - **cell_size** -- Size of Perlin cells, int.
4544  *   - **uchar** -- Output an unsigned char image, bool.
4545  *   - **seed** -- Random number seed, int.
4546  *
4547  * @param width Image width in pixels.
4548  * @param height Image height in pixels.
4549  * @param options Set of options.
4550  * @return Output image.
4551  */
4552 static VImage perlin( int width, int height, VOption *options = 0 );
4553 
4554 /**
4555  * Calculate phase correlation.
4556  * @param in2 Second input image.
4557  * @param options Set of options.
4558  * @return Output image.
4559  */
4560 VImage phasecor( VImage in2, VOption *options = 0 ) const;
4561 
4562 /**
4563  * Load png from file.
4564  *
4565  * **Optional parameters**
4566  *   - **unlimited** -- Remove all denial of service limits, bool.
4567  *   - **memory** -- Force open via memory, bool.
4568  *   - **access** -- Required access pattern for this file, VipsAccess.
4569  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4570  *
4571  * @param filename Filename to load from.
4572  * @param options Set of options.
4573  * @return Output image.
4574  */
4575 static VImage pngload( const char *filename, VOption *options = 0 );
4576 
4577 /**
4578  * Load png from buffer.
4579  *
4580  * **Optional parameters**
4581  *   - **unlimited** -- Remove all denial of service limits, bool.
4582  *   - **memory** -- Force open via memory, bool.
4583  *   - **access** -- Required access pattern for this file, VipsAccess.
4584  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4585  *
4586  * @param buffer Buffer to load from.
4587  * @param options Set of options.
4588  * @return Output image.
4589  */
4590 static VImage pngload_buffer( VipsBlob *buffer, VOption *options = 0 );
4591 
4592 /**
4593  * Load png from source.
4594  *
4595  * **Optional parameters**
4596  *   - **unlimited** -- Remove all denial of service limits, bool.
4597  *   - **memory** -- Force open via memory, bool.
4598  *   - **access** -- Required access pattern for this file, VipsAccess.
4599  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4600  *
4601  * @param source Source to load from.
4602  * @param options Set of options.
4603  * @return Output image.
4604  */
4605 static VImage pngload_source( VSource source, VOption *options = 0 );
4606 
4607 /**
4608  * Save image to png file.
4609  *
4610  * **Optional parameters**
4611  *   - **compression** -- Compression factor, int.
4612  *   - **interlace** -- Interlace image, bool.
4613  *   - **profile** -- ICC profile to embed, const char *.
4614  *   - **filter** -- libpng row filter flag(s), int.
4615  *   - **palette** -- Quantise to 8bpp palette, bool.
4616  *   - **Q** -- Quantisation quality, int.
4617  *   - **dither** -- Amount of dithering, double.
4618  *   - **bitdepth** -- Write as a 1, 2, 4 or 8 bit image, int.
4619  *   - **effort** -- Quantisation CPU effort, int.
4620  *   - **strip** -- Strip all metadata from image, bool.
4621  *   - **background** -- Background value, std::vector<double>.
4622  *   - **page_height** -- Set page height for multipage save, int.
4623  *
4624  * @param filename Filename to save to.
4625  * @param options Set of options.
4626  */
4627 void pngsave( const char *filename, VOption *options = 0 ) const;
4628 
4629 /**
4630  * Save image to png buffer.
4631  *
4632  * **Optional parameters**
4633  *   - **compression** -- Compression factor, int.
4634  *   - **interlace** -- Interlace image, bool.
4635  *   - **profile** -- ICC profile to embed, const char *.
4636  *   - **filter** -- libpng row filter flag(s), int.
4637  *   - **palette** -- Quantise to 8bpp palette, bool.
4638  *   - **Q** -- Quantisation quality, int.
4639  *   - **dither** -- Amount of dithering, double.
4640  *   - **bitdepth** -- Write as a 1, 2, 4 or 8 bit image, int.
4641  *   - **effort** -- Quantisation CPU effort, int.
4642  *   - **strip** -- Strip all metadata from image, bool.
4643  *   - **background** -- Background value, std::vector<double>.
4644  *   - **page_height** -- Set page height for multipage save, int.
4645  *
4646  * @param options Set of options.
4647  * @return Buffer to save to.
4648  */
4649 VipsBlob *pngsave_buffer( VOption *options = 0 ) const;
4650 
4651 /**
4652  * Save image to target as png.
4653  *
4654  * **Optional parameters**
4655  *   - **compression** -- Compression factor, int.
4656  *   - **interlace** -- Interlace image, bool.
4657  *   - **profile** -- ICC profile to embed, const char *.
4658  *   - **filter** -- libpng row filter flag(s), int.
4659  *   - **palette** -- Quantise to 8bpp palette, bool.
4660  *   - **Q** -- Quantisation quality, int.
4661  *   - **dither** -- Amount of dithering, double.
4662  *   - **bitdepth** -- Write as a 1, 2, 4 or 8 bit image, int.
4663  *   - **effort** -- Quantisation CPU effort, int.
4664  *   - **strip** -- Strip all metadata from image, bool.
4665  *   - **background** -- Background value, std::vector<double>.
4666  *   - **page_height** -- Set page height for multipage save, int.
4667  *
4668  * @param target Target to save to.
4669  * @param options Set of options.
4670  */
4671 void pngsave_target( VTarget target, VOption *options = 0 ) const;
4672 
4673 /**
4674  * Load ppm from file.
4675  *
4676  * **Optional parameters**
4677  *   - **memory** -- Force open via memory, bool.
4678  *   - **access** -- Required access pattern for this file, VipsAccess.
4679  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4680  *
4681  * @param filename Filename to load from.
4682  * @param options Set of options.
4683  * @return Output image.
4684  */
4685 static VImage ppmload( const char *filename, VOption *options = 0 );
4686 
4687 /**
4688  * Load ppm base class.
4689  *
4690  * **Optional parameters**
4691  *   - **memory** -- Force open via memory, bool.
4692  *   - **access** -- Required access pattern for this file, VipsAccess.
4693  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4694  *
4695  * @param source Source to load from.
4696  * @param options Set of options.
4697  * @return Output image.
4698  */
4699 static VImage ppmload_source( VSource source, VOption *options = 0 );
4700 
4701 /**
4702  * Save image to ppm file.
4703  *
4704  * **Optional parameters**
4705  *   - **format** -- Format to save in, VipsForeignPpmFormat.
4706  *   - **ascii** -- save as ascii, bool.
4707  *   - **bitdepth** -- set to 1 to write as a 1 bit image, int.
4708  *   - **strip** -- Strip all metadata from image, bool.
4709  *   - **background** -- Background value, std::vector<double>.
4710  *   - **page_height** -- Set page height for multipage save, int.
4711  *
4712  * @param filename Filename to save to.
4713  * @param options Set of options.
4714  */
4715 void ppmsave( const char *filename, VOption *options = 0 ) const;
4716 
4717 /**
4718  * Save to ppm.
4719  *
4720  * **Optional parameters**
4721  *   - **format** -- Format to save in, VipsForeignPpmFormat.
4722  *   - **ascii** -- save as ascii, bool.
4723  *   - **bitdepth** -- set to 1 to write as a 1 bit image, int.
4724  *   - **strip** -- Strip all metadata from image, bool.
4725  *   - **background** -- Background value, std::vector<double>.
4726  *   - **page_height** -- Set page height for multipage save, int.
4727  *
4728  * @param target Target to save to.
4729  * @param options Set of options.
4730  */
4731 void ppmsave_target( VTarget target, VOption *options = 0 ) const;
4732 
4733 /**
4734  * Premultiply image alpha.
4735  *
4736  * **Optional parameters**
4737  *   - **max_alpha** -- Maximum value of alpha channel, double.
4738  *
4739  * @param options Set of options.
4740  * @return Output image.
4741  */
4742 VImage premultiply( VOption *options = 0 ) const;
4743 
4744 /**
4745  * Find image profiles.
4746  * @param rows First non-zero pixel in row.
4747  * @param options Set of options.
4748  * @return First non-zero pixel in column.
4749  */
4750 VImage profile( VImage *rows, VOption *options = 0 ) const;
4751 
4752 /**
4753  * Load named icc profile.
4754  * @param name Profile name.
4755  * @param options Set of options.
4756  * @return Loaded profile.
4757  */
4758 static VipsBlob *profile_load( const char *name, VOption *options = 0 );
4759 
4760 /**
4761  * Find image projections.
4762  * @param rows Sums of rows.
4763  * @param options Set of options.
4764  * @return Sums of columns.
4765  */
4766 VImage project( VImage *rows, VOption *options = 0 ) const;
4767 
4768 /**
4769  * Resample an image with a quadratic transform.
4770  *
4771  * **Optional parameters**
4772  *   - **interpolate** -- Interpolate values with this, VInterpolate.
4773  *
4774  * @param coeff Coefficient matrix.
4775  * @param options Set of options.
4776  * @return Output image.
4777  */
4778 VImage quadratic( VImage coeff, VOption *options = 0 ) const;
4779 
4780 /**
4781  * Unpack radiance coding to float rgb.
4782  * @param options Set of options.
4783  * @return Output image.
4784  */
4785 VImage rad2float( VOption *options = 0 ) const;
4786 
4787 /**
4788  * Load a radiance image from a file.
4789  *
4790  * **Optional parameters**
4791  *   - **memory** -- Force open via memory, bool.
4792  *   - **access** -- Required access pattern for this file, VipsAccess.
4793  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4794  *
4795  * @param filename Filename to load from.
4796  * @param options Set of options.
4797  * @return Output image.
4798  */
4799 static VImage radload( const char *filename, VOption *options = 0 );
4800 
4801 /**
4802  * Load rad from buffer.
4803  *
4804  * **Optional parameters**
4805  *   - **memory** -- Force open via memory, bool.
4806  *   - **access** -- Required access pattern for this file, VipsAccess.
4807  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4808  *
4809  * @param buffer Buffer to load from.
4810  * @param options Set of options.
4811  * @return Output image.
4812  */
4813 static VImage radload_buffer( VipsBlob *buffer, VOption *options = 0 );
4814 
4815 /**
4816  * Load rad from source.
4817  *
4818  * **Optional parameters**
4819  *   - **memory** -- Force open via memory, bool.
4820  *   - **access** -- Required access pattern for this file, VipsAccess.
4821  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4822  *
4823  * @param source Source to load from.
4824  * @param options Set of options.
4825  * @return Output image.
4826  */
4827 static VImage radload_source( VSource source, VOption *options = 0 );
4828 
4829 /**
4830  * Save image to radiance file.
4831  *
4832  * **Optional parameters**
4833  *   - **strip** -- Strip all metadata from image, bool.
4834  *   - **background** -- Background value, std::vector<double>.
4835  *   - **page_height** -- Set page height for multipage save, int.
4836  *
4837  * @param filename Filename to save to.
4838  * @param options Set of options.
4839  */
4840 void radsave( const char *filename, VOption *options = 0 ) const;
4841 
4842 /**
4843  * Save image to radiance buffer.
4844  *
4845  * **Optional parameters**
4846  *   - **strip** -- Strip all metadata from image, bool.
4847  *   - **background** -- Background value, std::vector<double>.
4848  *   - **page_height** -- Set page height for multipage save, int.
4849  *
4850  * @param options Set of options.
4851  * @return Buffer to save to.
4852  */
4853 VipsBlob *radsave_buffer( VOption *options = 0 ) const;
4854 
4855 /**
4856  * Save image to radiance target.
4857  *
4858  * **Optional parameters**
4859  *   - **strip** -- Strip all metadata from image, bool.
4860  *   - **background** -- Background value, std::vector<double>.
4861  *   - **page_height** -- Set page height for multipage save, int.
4862  *
4863  * @param target Target to save to.
4864  * @param options Set of options.
4865  */
4866 void radsave_target( VTarget target, VOption *options = 0 ) const;
4867 
4868 /**
4869  * Rank filter.
4870  * @param width Window width in pixels.
4871  * @param height Window height in pixels.
4872  * @param index Select pixel at index.
4873  * @param options Set of options.
4874  * @return Output image.
4875  */
4876 VImage rank( int width, int height, int index, VOption *options = 0 ) const;
4877 
4878 /**
4879  * Load raw data from a file.
4880  *
4881  * **Optional parameters**
4882  *   - **offset** -- Offset in bytes from start of file, guint64.
4883  *   - **format** -- Pixel format in image, VipsBandFormat.
4884  *   - **interpretation** -- Pixel interpretation, VipsInterpretation.
4885  *   - **memory** -- Force open via memory, bool.
4886  *   - **access** -- Required access pattern for this file, VipsAccess.
4887  *   - **fail_on** -- Error level to fail on, VipsFailOn.
4888  *
4889  * @param filename Filename to load from.
4890  * @param width Image width in pixels.
4891  * @param height Image height in pixels.
4892  * @param bands Number of bands in image.
4893  * @param options Set of options.
4894  * @return Output image.
4895  */
4896 static VImage rawload( const char *filename, int width, int height, int bands, VOption *options = 0 );
4897 
4898 /**
4899  * Save image to raw file.
4900  *
4901  * **Optional parameters**
4902  *   - **strip** -- Strip all metadata from image, bool.
4903  *   - **background** -- Background value, std::vector<double>.
4904  *   - **page_height** -- Set page height for multipage save, int.
4905  *
4906  * @param filename Filename to save to.
4907  * @param options Set of options.
4908  */
4909 void rawsave( const char *filename, VOption *options = 0 ) const;
4910 
4911 /**
4912  * Write raw image to file descriptor.
4913  *
4914  * **Optional parameters**
4915  *   - **strip** -- Strip all metadata from image, bool.
4916  *   - **background** -- Background value, std::vector<double>.
4917  *   - **page_height** -- Set page height for multipage save, int.
4918  *
4919  * @param fd File descriptor to write to.
4920  * @param options Set of options.
4921  */
4922 void rawsave_fd( int fd, VOption *options = 0 ) const;
4923 
4924 /**
4925  * Linear recombination with matrix.
4926  * @param m matrix of coefficients.
4927  * @param options Set of options.
4928  * @return Output image.
4929  */
4930 VImage recomb( VImage m, VOption *options = 0 ) const;
4931 
4932 /**
4933  * Reduce an image.
4934  *
4935  * **Optional parameters**
4936  *   - **kernel** -- Resampling kernel, VipsKernel.
4937  *
4938  * @param hshrink Horizontal shrink factor.
4939  * @param vshrink Vertical shrink factor.
4940  * @param options Set of options.
4941  * @return Output image.
4942  */
4943 VImage reduce( double hshrink, double vshrink, VOption *options = 0 ) const;
4944 
4945 /**
4946  * Shrink an image horizontally.
4947  *
4948  * **Optional parameters**
4949  *   - **kernel** -- Resampling kernel, VipsKernel.
4950  *
4951  * @param hshrink Horizontal shrink factor.
4952  * @param options Set of options.
4953  * @return Output image.
4954  */
4955 VImage reduceh( double hshrink, VOption *options = 0 ) const;
4956 
4957 /**
4958  * Shrink an image vertically.
4959  *
4960  * **Optional parameters**
4961  *   - **kernel** -- Resampling kernel, VipsKernel.
4962  *
4963  * @param vshrink Vertical shrink factor.
4964  * @param options Set of options.
4965  * @return Output image.
4966  */
4967 VImage reducev( double vshrink, VOption *options = 0 ) const;
4968 
4969 /**
4970  * Relational operation on two images.
4971  * @param right Right-hand image argument.
4972  * @param relational relational to perform.
4973  * @param options Set of options.
4974  * @return Output image.
4975  */
4976 VImage relational( VImage right, VipsOperationRelational relational, VOption *options = 0 ) const;
4977 
4978 /**
4979  * Relational operations against a constant.
4980  * @param relational relational to perform.
4981  * @param c Array of constants.
4982  * @param options Set of options.
4983  * @return Output image.
4984  */
4985 VImage relational_const( VipsOperationRelational relational, std::vector<double> c, VOption *options = 0 ) const;
4986 
4987 /**
4988  * Remainder after integer division of two images.
4989  * @param right Right-hand image argument.
4990  * @param options Set of options.
4991  * @return Output image.
4992  */
4993 VImage remainder( VImage right, VOption *options = 0 ) const;
4994 
4995 /**
4996  * Remainder after integer division of an image and a constant.
4997  * @param c Array of constants.
4998  * @param options Set of options.
4999  * @return Output image.
5000  */
5001 VImage remainder_const( std::vector<double> c, VOption *options = 0 ) const;
5002 
5003 /**
5004  * Replicate an image.
5005  * @param across Repeat this many times horizontally.
5006  * @param down Repeat this many times vertically.
5007  * @param options Set of options.
5008  * @return Output image.
5009  */
5010 VImage replicate( int across, int down, VOption *options = 0 ) const;
5011 
5012 /**
5013  * Resize an image.
5014  *
5015  * **Optional parameters**
5016  *   - **kernel** -- Resampling kernel, VipsKernel.
5017  *   - **vscale** -- Vertical scale image by this factor, double.
5018  *
5019  * @param scale Scale image by this factor.
5020  * @param options Set of options.
5021  * @return Output image.
5022  */
5023 VImage resize( double scale, VOption *options = 0 ) const;
5024 
5025 /**
5026  * Rotate an image.
5027  * @param angle Angle to rotate image.
5028  * @param options Set of options.
5029  * @return Output image.
5030  */
5031 VImage rot( VipsAngle angle, VOption *options = 0 ) const;
5032 
5033 /**
5034  * Rotate an image.
5035  *
5036  * **Optional parameters**
5037  *   - **angle** -- Angle to rotate image, VipsAngle45.
5038  *
5039  * @param options Set of options.
5040  * @return Output image.
5041  */
5042 VImage rot45( VOption *options = 0 ) const;
5043 
5044 /**
5045  * Rotate an image by a number of degrees.
5046  *
5047  * **Optional parameters**
5048  *   - **interpolate** -- Interpolate pixels with this, VInterpolate.
5049  *   - **background** -- Background value, std::vector<double>.
5050  *   - **odx** -- Horizontal output displacement, double.
5051  *   - **ody** -- Vertical output displacement, double.
5052  *   - **idx** -- Horizontal input displacement, double.
5053  *   - **idy** -- Vertical input displacement, double.
5054  *
5055  * @param angle Rotate anticlockwise by this many degrees.
5056  * @param options Set of options.
5057  * @return Output image.
5058  */
5059 VImage rotate( double angle, VOption *options = 0 ) const;
5060 
5061 /**
5062  * Perform a round function on an image.
5063  * @param round rounding operation to perform.
5064  * @param options Set of options.
5065  * @return Output image.
5066  */
5067 VImage round( VipsOperationRound round, VOption *options = 0 ) const;
5068 
5069 /**
5070  * Transform srgb to hsv.
5071  * @param options Set of options.
5072  * @return Output image.
5073  */
5074 VImage sRGB2HSV( VOption *options = 0 ) const;
5075 
5076 /**
5077  * Convert an srgb image to scrgb.
5078  * @param options Set of options.
5079  * @return Output image.
5080  */
5081 VImage sRGB2scRGB( VOption *options = 0 ) const;
5082 
5083 /**
5084  * Convert scrgb to bw.
5085  *
5086  * **Optional parameters**
5087  *   - **depth** -- Output device space depth in bits, int.
5088  *
5089  * @param options Set of options.
5090  * @return Output image.
5091  */
5092 VImage scRGB2BW( VOption *options = 0 ) const;
5093 
5094 /**
5095  * Transform scrgb to xyz.
5096  * @param options Set of options.
5097  * @return Output image.
5098  */
5099 VImage scRGB2XYZ( VOption *options = 0 ) const;
5100 
5101 /**
5102  * Convert an scrgb image to srgb.
5103  *
5104  * **Optional parameters**
5105  *   - **depth** -- Output device space depth in bits, int.
5106  *
5107  * @param options Set of options.
5108  * @return Output image.
5109  */
5110 VImage scRGB2sRGB( VOption *options = 0 ) const;
5111 
5112 /**
5113  * Scale an image to uchar.
5114  *
5115  * **Optional parameters**
5116  *   - **exp** -- Exponent for log scale, double.
5117  *   - **log** -- Log scale, bool.
5118  *
5119  * @param options Set of options.
5120  * @return Output image.
5121  */
5122 VImage scale( VOption *options = 0 ) const;
5123 
5124 /**
5125  * Check sequential access.
5126  *
5127  * **Optional parameters**
5128  *   - **tile_height** -- Tile height in pixels, int.
5129  *
5130  * @param options Set of options.
5131  * @return Output image.
5132  */
5133 VImage sequential( VOption *options = 0 ) const;
5134 
5135 /**
5136  * Unsharp masking for print.
5137  *
5138  * **Optional parameters**
5139  *   - **sigma** -- Sigma of Gaussian, double.
5140  *   - **x1** -- Flat/jaggy threshold, double.
5141  *   - **y2** -- Maximum brightening, double.
5142  *   - **y3** -- Maximum darkening, double.
5143  *   - **m1** -- Slope for flat areas, double.
5144  *   - **m2** -- Slope for jaggy areas, double.
5145  *
5146  * @param options Set of options.
5147  * @return Output image.
5148  */
5149 VImage sharpen( VOption *options = 0 ) const;
5150 
5151 /**
5152  * Shrink an image.
5153  * @param hshrink Horizontal shrink factor.
5154  * @param vshrink Vertical shrink factor.
5155  * @param options Set of options.
5156  * @return Output image.
5157  */
5158 VImage shrink( double hshrink, double vshrink, VOption *options = 0 ) const;
5159 
5160 /**
5161  * Shrink an image horizontally.
5162  * @param hshrink Horizontal shrink factor.
5163  * @param options Set of options.
5164  * @return Output image.
5165  */
5166 VImage shrinkh( int hshrink, VOption *options = 0 ) const;
5167 
5168 /**
5169  * Shrink an image vertically.
5170  * @param vshrink Vertical shrink factor.
5171  * @param options Set of options.
5172  * @return Output image.
5173  */
5174 VImage shrinkv( int vshrink, VOption *options = 0 ) const;
5175 
5176 /**
5177  * Unit vector of pixel.
5178  * @param options Set of options.
5179  * @return Output image.
5180  */
5181 VImage sign( VOption *options = 0 ) const;
5182 
5183 /**
5184  * Similarity transform of an image.
5185  *
5186  * **Optional parameters**
5187  *   - **scale** -- Scale by this factor, double.
5188  *   - **angle** -- Rotate anticlockwise by this many degrees, double.
5189  *   - **interpolate** -- Interpolate pixels with this, VInterpolate.
5190  *   - **background** -- Background value, std::vector<double>.
5191  *   - **odx** -- Horizontal output displacement, double.
5192  *   - **ody** -- Vertical output displacement, double.
5193  *   - **idx** -- Horizontal input displacement, double.
5194  *   - **idy** -- Vertical input displacement, double.
5195  *
5196  * @param options Set of options.
5197  * @return Output image.
5198  */
5199 VImage similarity( VOption *options = 0 ) const;
5200 
5201 /**
5202  * Make a 2d sine wave.
5203  *
5204  * **Optional parameters**
5205  *   - **uchar** -- Output an unsigned char image, bool.
5206  *   - **hfreq** -- Horizontal spatial frequency, double.
5207  *   - **vfreq** -- Vertical spatial frequency, double.
5208  *
5209  * @param width Image width in pixels.
5210  * @param height Image height in pixels.
5211  * @param options Set of options.
5212  * @return Output image.
5213  */
5214 static VImage sines( int width, int height, VOption *options = 0 );
5215 
5216 /**
5217  * Extract an area from an image.
5218  *
5219  * **Optional parameters**
5220  *   - **interesting** -- How to measure interestingness, VipsInteresting.
5221  *
5222  * @param width Width of extract area.
5223  * @param height Height of extract area.
5224  * @param options Set of options.
5225  * @return Output image.
5226  */
5227 VImage smartcrop( int width, int height, VOption *options = 0 ) const;
5228 
5229 /**
5230  * Sobel edge detector.
5231  * @param options Set of options.
5232  * @return Output image.
5233  */
5234 VImage sobel( VOption *options = 0 ) const;
5235 
5236 /**
5237  * Spatial correlation.
5238  * @param ref Input reference image.
5239  * @param options Set of options.
5240  * @return Output image.
5241  */
5242 VImage spcor( VImage ref, VOption *options = 0 ) const;
5243 
5244 /**
5245  * Make displayable power spectrum.
5246  * @param options Set of options.
5247  * @return Output image.
5248  */
5249 VImage spectrum( VOption *options = 0 ) const;
5250 
5251 /**
5252  * Find many image stats.
5253  * @param options Set of options.
5254  * @return Output array of statistics.
5255  */
5256 VImage stats( VOption *options = 0 ) const;
5257 
5258 /**
5259  * Statistical difference.
5260  *
5261  * **Optional parameters**
5262  *   - **s0** -- New deviation, double.
5263  *   - **b** -- Weight of new deviation, double.
5264  *   - **m0** -- New mean, double.
5265  *   - **a** -- Weight of new mean, double.
5266  *
5267  * @param width Window width in pixels.
5268  * @param height Window height in pixels.
5269  * @param options Set of options.
5270  * @return Output image.
5271  */
5272 VImage stdif( int width, int height, VOption *options = 0 ) const;
5273 
5274 /**
5275  * Subsample an image.
5276  *
5277  * **Optional parameters**
5278  *   - **point** -- Point sample, bool.
5279  *
5280  * @param xfac Horizontal subsample factor.
5281  * @param yfac Vertical subsample factor.
5282  * @param options Set of options.
5283  * @return Output image.
5284  */
5285 VImage subsample( int xfac, int yfac, VOption *options = 0 ) const;
5286 
5287 /**
5288  * Subtract two images.
5289  * @param right Right-hand image argument.
5290  * @param options Set of options.
5291  * @return Output image.
5292  */
5293 VImage subtract( VImage right, VOption *options = 0 ) const;
5294 
5295 /**
5296  * Sum an array of images.
5297  * @param in Array of input images.
5298  * @param options Set of options.
5299  * @return Output image.
5300  */
5301 static VImage sum( std::vector<VImage> in, VOption *options = 0 );
5302 
5303 /**
5304  * Load svg with rsvg.
5305  *
5306  * **Optional parameters**
5307  *   - **dpi** -- Render at this DPI, double.
5308  *   - **scale** -- Scale output by this factor, double.
5309  *   - **unlimited** -- Allow SVG of any size, bool.
5310  *   - **memory** -- Force open via memory, bool.
5311  *   - **access** -- Required access pattern for this file, VipsAccess.
5312  *   - **fail_on** -- Error level to fail on, VipsFailOn.
5313  *
5314  * @param filename Filename to load from.
5315  * @param options Set of options.
5316  * @return Output image.
5317  */
5318 static VImage svgload( const char *filename, VOption *options = 0 );
5319 
5320 /**
5321  * Load svg with rsvg.
5322  *
5323  * **Optional parameters**
5324  *   - **dpi** -- Render at this DPI, double.
5325  *   - **scale** -- Scale output by this factor, double.
5326  *   - **unlimited** -- Allow SVG of any size, bool.
5327  *   - **memory** -- Force open via memory, bool.
5328  *   - **access** -- Required access pattern for this file, VipsAccess.
5329  *   - **fail_on** -- Error level to fail on, VipsFailOn.
5330  *
5331  * @param buffer Buffer to load from.
5332  * @param options Set of options.
5333  * @return Output image.
5334  */
5335 static VImage svgload_buffer( VipsBlob *buffer, VOption *options = 0 );
5336 
5337 /**
5338  * Load svg from source.
5339  *
5340  * **Optional parameters**
5341  *   - **dpi** -- Render at this DPI, double.
5342  *   - **scale** -- Scale output by this factor, double.
5343  *   - **unlimited** -- Allow SVG of any size, bool.
5344  *   - **memory** -- Force open via memory, bool.
5345  *   - **access** -- Required access pattern for this file, VipsAccess.
5346  *   - **fail_on** -- Error level to fail on, VipsFailOn.
5347  *
5348  * @param source Source to load from.
5349  * @param options Set of options.
5350  * @return Output image.
5351  */
5352 static VImage svgload_source( VSource source, VOption *options = 0 );
5353 
5354 /**
5355  * Find the index of the first non-zero pixel in tests.
5356  * @param tests Table of images to test.
5357  * @param options Set of options.
5358  * @return Output image.
5359  */
5360 static VImage switch_image( std::vector<VImage> tests, VOption *options = 0 );
5361 
5362 /**
5363  * Run an external command.
5364  *
5365  * **Optional parameters**
5366  *   - **in** -- Array of input images, std::vector<VImage>.
5367  *   - **out_format** -- Format for output filename, const char *.
5368  *   - **in_format** -- Format for input filename, const char *.
5369  *
5370  * @param cmd_format Command to run.
5371  * @param options Set of options.
5372  */
5373 static void system( const char *cmd_format, VOption *options = 0 );
5374 
5375 /**
5376  * Make a text image.
5377  *
5378  * **Optional parameters**
5379  *   - **font** -- Font to render with, const char *.
5380  *   - **width** -- Maximum image width in pixels, int.
5381  *   - **height** -- Maximum image height in pixels, int.
5382  *   - **align** -- Align on the low, centre or high edge, VipsAlign.
5383  *   - **rgba** -- Enable RGBA output, bool.
5384  *   - **dpi** -- DPI to render at, int.
5385  *   - **justify** -- Justify lines, bool.
5386  *   - **spacing** -- Line spacing, int.
5387  *   - **fontfile** -- Load this font file, const char *.
5388  *
5389  * @param text Text to render.
5390  * @param options Set of options.
5391  * @return Output image.
5392  */
5393 static VImage text( const char *text, VOption *options = 0 );
5394 
5395 /**
5396  * Generate thumbnail from file.
5397  *
5398  * **Optional parameters**
5399  *   - **height** -- Size to this height, int.
5400  *   - **size** -- Only upsize, only downsize, or both, VipsSize.
5401  *   - **no_rotate** -- Don't use orientation tags to rotate image upright, bool.
5402  *   - **crop** -- Reduce to fill target rectangle, then crop, VipsInteresting.
5403  *   - **linear** -- Reduce in linear light, bool.
5404  *   - **import_profile** -- Fallback import profile, const char *.
5405  *   - **export_profile** -- Fallback export profile, const char *.
5406  *   - **intent** -- Rendering intent, VipsIntent.
5407  *
5408  * @param filename Filename to read from.
5409  * @param width Size to this width.
5410  * @param options Set of options.
5411  * @return Output image.
5412  */
5413 static VImage thumbnail( const char *filename, int width, VOption *options = 0 );
5414 
5415 /**
5416  * Generate thumbnail from buffer.
5417  *
5418  * **Optional parameters**
5419  *   - **option_string** -- Options that are passed on to the underlying loader, const char *.
5420  *   - **height** -- Size to this height, int.
5421  *   - **size** -- Only upsize, only downsize, or both, VipsSize.
5422  *   - **no_rotate** -- Don't use orientation tags to rotate image upright, bool.
5423  *   - **crop** -- Reduce to fill target rectangle, then crop, VipsInteresting.
5424  *   - **linear** -- Reduce in linear light, bool.
5425  *   - **import_profile** -- Fallback import profile, const char *.
5426  *   - **export_profile** -- Fallback export profile, const char *.
5427  *   - **intent** -- Rendering intent, VipsIntent.
5428  *
5429  * @param buffer Buffer to load from.
5430  * @param width Size to this width.
5431  * @param options Set of options.
5432  * @return Output image.
5433  */
5434 static VImage thumbnail_buffer( VipsBlob *buffer, int width, VOption *options = 0 );
5435 
5436 /**
5437  * Generate thumbnail from image.
5438  *
5439  * **Optional parameters**
5440  *   - **height** -- Size to this height, int.
5441  *   - **size** -- Only upsize, only downsize, or both, VipsSize.
5442  *   - **no_rotate** -- Don't use orientation tags to rotate image upright, bool.
5443  *   - **crop** -- Reduce to fill target rectangle, then crop, VipsInteresting.
5444  *   - **linear** -- Reduce in linear light, bool.
5445  *   - **import_profile** -- Fallback import profile, const char *.
5446  *   - **export_profile** -- Fallback export profile, const char *.
5447  *   - **intent** -- Rendering intent, VipsIntent.
5448  *
5449  * @param width Size to this width.
5450  * @param options Set of options.
5451  * @return Output image.
5452  */
5453 VImage thumbnail_image( int width, VOption *options = 0 ) const;
5454 
5455 /**
5456  * Generate thumbnail from source.
5457  *
5458  * **Optional parameters**
5459  *   - **option_string** -- Options that are passed on to the underlying loader, const char *.
5460  *   - **height** -- Size to this height, int.
5461  *   - **size** -- Only upsize, only downsize, or both, VipsSize.
5462  *   - **no_rotate** -- Don't use orientation tags to rotate image upright, bool.
5463  *   - **crop** -- Reduce to fill target rectangle, then crop, VipsInteresting.
5464  *   - **linear** -- Reduce in linear light, bool.
5465  *   - **import_profile** -- Fallback import profile, const char *.
5466  *   - **export_profile** -- Fallback export profile, const char *.
5467  *   - **intent** -- Rendering intent, VipsIntent.
5468  *
5469  * @param source Source to load from.
5470  * @param width Size to this width.
5471  * @param options Set of options.
5472  * @return Output image.
5473  */
5474 static VImage thumbnail_source( VSource source, int width, VOption *options = 0 );
5475 
5476 /**
5477  * Load tiff from file.
5478  *
5479  * **Optional parameters**
5480  *   - **page** -- Load this page from the image, int.
5481  *   - **subifd** -- Select subifd index, int.
5482  *   - **n** -- Load this many pages, int.
5483  *   - **autorotate** -- Rotate image using orientation tag, bool.
5484  *   - **memory** -- Force open via memory, bool.
5485  *   - **access** -- Required access pattern for this file, VipsAccess.
5486  *   - **fail_on** -- Error level to fail on, VipsFailOn.
5487  *
5488  * @param filename Filename to load from.
5489  * @param options Set of options.
5490  * @return Output image.
5491  */
5492 static VImage tiffload( const char *filename, VOption *options = 0 );
5493 
5494 /**
5495  * Load tiff from buffer.
5496  *
5497  * **Optional parameters**
5498  *   - **page** -- Load this page from the image, int.
5499  *   - **subifd** -- Select subifd index, int.
5500  *   - **n** -- Load this many pages, int.
5501  *   - **autorotate** -- Rotate image using orientation tag, bool.
5502  *   - **memory** -- Force open via memory, bool.
5503  *   - **access** -- Required access pattern for this file, VipsAccess.
5504  *   - **fail_on** -- Error level to fail on, VipsFailOn.
5505  *
5506  * @param buffer Buffer to load from.
5507  * @param options Set of options.
5508  * @return Output image.
5509  */
5510 static VImage tiffload_buffer( VipsBlob *buffer, VOption *options = 0 );
5511 
5512 /**
5513  * Load tiff from source.
5514  *
5515  * **Optional parameters**
5516  *   - **page** -- Load this page from the image, int.
5517  *   - **subifd** -- Select subifd index, int.
5518  *   - **n** -- Load this many pages, int.
5519  *   - **autorotate** -- Rotate image using orientation tag, bool.
5520  *   - **memory** -- Force open via memory, bool.
5521  *   - **access** -- Required access pattern for this file, VipsAccess.
5522  *   - **fail_on** -- Error level to fail on, VipsFailOn.
5523  *
5524  * @param source Source to load from.
5525  * @param options Set of options.
5526  * @return Output image.
5527  */
5528 static VImage tiffload_source( VSource source, VOption *options = 0 );
5529 
5530 /**
5531  * Save image to tiff file.
5532  *
5533  * **Optional parameters**
5534  *   - **compression** -- Compression for this file, VipsForeignTiffCompression.
5535  *   - **Q** -- Q factor, int.
5536  *   - **predictor** -- Compression prediction, VipsForeignTiffPredictor.
5537  *   - **profile** -- ICC profile to embed, const char *.
5538  *   - **tile** -- Write a tiled tiff, bool.
5539  *   - **tile_width** -- Tile width in pixels, int.
5540  *   - **tile_height** -- Tile height in pixels, int.
5541  *   - **pyramid** -- Write a pyramidal tiff, bool.
5542  *   - **miniswhite** -- Use 0 for white in 1-bit images, bool.
5543  *   - **bitdepth** -- Write as a 1, 2, 4 or 8 bit image, int.
5544  *   - **resunit** -- Resolution unit, VipsForeignTiffResunit.
5545  *   - **xres** -- Horizontal resolution in pixels/mm, double.
5546  *   - **yres** -- Vertical resolution in pixels/mm, double.
5547  *   - **bigtiff** -- Write a bigtiff image, bool.
5548  *   - **properties** -- Write a properties document to IMAGEDESCRIPTION, bool.
5549  *   - **region_shrink** -- Method to shrink regions, VipsRegionShrink.
5550  *   - **level** -- ZSTD compression level, int.
5551  *   - **lossless** -- Enable WEBP lossless mode, bool.
5552  *   - **depth** -- Pyramid depth, VipsForeignDzDepth.
5553  *   - **subifd** -- Save pyr layers as sub-IFDs, bool.
5554  *   - **premultiply** -- Save with premultiplied alpha, bool.
5555  *   - **strip** -- Strip all metadata from image, bool.
5556  *   - **background** -- Background value, std::vector<double>.
5557  *   - **page_height** -- Set page height for multipage save, int.
5558  *
5559  * @param filename Filename to save to.
5560  * @param options Set of options.
5561  */
5562 void tiffsave( const char *filename, VOption *options = 0 ) const;
5563 
5564 /**
5565  * Save image to tiff buffer.
5566  *
5567  * **Optional parameters**
5568  *   - **compression** -- Compression for this file, VipsForeignTiffCompression.
5569  *   - **Q** -- Q factor, int.
5570  *   - **predictor** -- Compression prediction, VipsForeignTiffPredictor.
5571  *   - **profile** -- ICC profile to embed, const char *.
5572  *   - **tile** -- Write a tiled tiff, bool.
5573  *   - **tile_width** -- Tile width in pixels, int.
5574  *   - **tile_height** -- Tile height in pixels, int.
5575  *   - **pyramid** -- Write a pyramidal tiff, bool.
5576  *   - **miniswhite** -- Use 0 for white in 1-bit images, bool.
5577  *   - **bitdepth** -- Write as a 1, 2, 4 or 8 bit image, int.
5578  *   - **resunit** -- Resolution unit, VipsForeignTiffResunit.
5579  *   - **xres** -- Horizontal resolution in pixels/mm, double.
5580  *   - **yres** -- Vertical resolution in pixels/mm, double.
5581  *   - **bigtiff** -- Write a bigtiff image, bool.
5582  *   - **properties** -- Write a properties document to IMAGEDESCRIPTION, bool.
5583  *   - **region_shrink** -- Method to shrink regions, VipsRegionShrink.
5584  *   - **level** -- ZSTD compression level, int.
5585  *   - **lossless** -- Enable WEBP lossless mode, bool.
5586  *   - **depth** -- Pyramid depth, VipsForeignDzDepth.
5587  *   - **subifd** -- Save pyr layers as sub-IFDs, bool.
5588  *   - **premultiply** -- Save with premultiplied alpha, bool.
5589  *   - **strip** -- Strip all metadata from image, bool.
5590  *   - **background** -- Background value, std::vector<double>.
5591  *   - **page_height** -- Set page height for multipage save, int.
5592  *
5593  * @param options Set of options.
5594  * @return Buffer to save to.
5595  */
5596 VipsBlob *tiffsave_buffer( VOption *options = 0 ) const;
5597 
5598 /**
5599  * Cache an image as a set of tiles.
5600  *
5601  * **Optional parameters**
5602  *   - **tile_width** -- Tile width in pixels, int.
5603  *   - **tile_height** -- Tile height in pixels, int.
5604  *   - **max_tiles** -- Maximum number of tiles to cache, int.
5605  *   - **access** -- Expected access pattern, VipsAccess.
5606  *   - **threaded** -- Allow threaded access, bool.
5607  *   - **persistent** -- Keep cache between evaluations, bool.
5608  *
5609  * @param options Set of options.
5610  * @return Output image.
5611  */
5612 VImage tilecache( VOption *options = 0 ) const;
5613 
5614 /**
5615  * Build a look-up table.
5616  *
5617  * **Optional parameters**
5618  *   - **in_max** -- Size of LUT to build, int.
5619  *   - **out_max** -- Maximum value in output LUT, int.
5620  *   - **Lb** -- Lowest value in output, double.
5621  *   - **Lw** -- Highest value in output, double.
5622  *   - **Ps** -- Position of shadow, double.
5623  *   - **Pm** -- Position of mid-tones, double.
5624  *   - **Ph** -- Position of highlights, double.
5625  *   - **S** -- Adjust shadows by this much, double.
5626  *   - **M** -- Adjust mid-tones by this much, double.
5627  *   - **H** -- Adjust highlights by this much, double.
5628  *
5629  * @param options Set of options.
5630  * @return Output image.
5631  */
5632 static VImage tonelut( VOption *options = 0 );
5633 
5634 /**
5635  * Transpose3d an image.
5636  *
5637  * **Optional parameters**
5638  *   - **page_height** -- Height of each input page, int.
5639  *
5640  * @param options Set of options.
5641  * @return Output image.
5642  */
5643 VImage transpose3d( VOption *options = 0 ) const;
5644 
5645 /**
5646  * Unpremultiply image alpha.
5647  *
5648  * **Optional parameters**
5649  *   - **max_alpha** -- Maximum value of alpha channel, double.
5650  *   - **alpha_band** -- Unpremultiply with this alpha, int.
5651  *
5652  * @param options Set of options.
5653  * @return Output image.
5654  */
5655 VImage unpremultiply( VOption *options = 0 ) const;
5656 
5657 /**
5658  * Load vips from file.
5659  *
5660  * **Optional parameters**
5661  *   - **memory** -- Force open via memory, bool.
5662  *   - **access** -- Required access pattern for this file, VipsAccess.
5663  *   - **fail_on** -- Error level to fail on, VipsFailOn.
5664  *
5665  * @param filename Filename to load from.
5666  * @param options Set of options.
5667  * @return Output image.
5668  */
5669 static VImage vipsload( const char *filename, VOption *options = 0 );
5670 
5671 /**
5672  * Load vips from source.
5673  *
5674  * **Optional parameters**
5675  *   - **memory** -- Force open via memory, bool.
5676  *   - **access** -- Required access pattern for this file, VipsAccess.
5677  *   - **fail_on** -- Error level to fail on, VipsFailOn.
5678  *
5679  * @param source Source to load from.
5680  * @param options Set of options.
5681  * @return Output image.
5682  */
5683 static VImage vipsload_source( VSource source, VOption *options = 0 );
5684 
5685 /**
5686  * Save image to file in vips format.
5687  *
5688  * **Optional parameters**
5689  *   - **strip** -- Strip all metadata from image, bool.
5690  *   - **background** -- Background value, std::vector<double>.
5691  *   - **page_height** -- Set page height for multipage save, int.
5692  *
5693  * @param filename Filename to save to.
5694  * @param options Set of options.
5695  */
5696 void vipssave( const char *filename, VOption *options = 0 ) const;
5697 
5698 /**
5699  * Save image to target in vips format.
5700  *
5701  * **Optional parameters**
5702  *   - **strip** -- Strip all metadata from image, bool.
5703  *   - **background** -- Background value, std::vector<double>.
5704  *   - **page_height** -- Set page height for multipage save, int.
5705  *
5706  * @param target Target to save to.
5707  * @param options Set of options.
5708  */
5709 void vipssave_target( VTarget target, VOption *options = 0 ) const;
5710 
5711 /**
5712  * Load webp from file.
5713  *
5714  * **Optional parameters**
5715  *   - **page** -- Load this page from the file, int.
5716  *   - **n** -- Load this many pages, int.
5717  *   - **scale** -- Scale factor on load, double.
5718  *   - **memory** -- Force open via memory, bool.
5719  *   - **access** -- Required access pattern for this file, VipsAccess.
5720  *   - **fail_on** -- Error level to fail on, VipsFailOn.
5721  *
5722  * @param filename Filename to load from.
5723  * @param options Set of options.
5724  * @return Output image.
5725  */
5726 static VImage webpload( const char *filename, VOption *options = 0 );
5727 
5728 /**
5729  * Load webp from buffer.
5730  *
5731  * **Optional parameters**
5732  *   - **page** -- Load this page from the file, int.
5733  *   - **n** -- Load this many pages, int.
5734  *   - **scale** -- Scale factor on load, double.
5735  *   - **memory** -- Force open via memory, bool.
5736  *   - **access** -- Required access pattern for this file, VipsAccess.
5737  *   - **fail_on** -- Error level to fail on, VipsFailOn.
5738  *
5739  * @param buffer Buffer to load from.
5740  * @param options Set of options.
5741  * @return Output image.
5742  */
5743 static VImage webpload_buffer( VipsBlob *buffer, VOption *options = 0 );
5744 
5745 /**
5746  * Load webp from source.
5747  *
5748  * **Optional parameters**
5749  *   - **page** -- Load this page from the file, int.
5750  *   - **n** -- Load this many pages, int.
5751  *   - **scale** -- Scale factor on load, double.
5752  *   - **memory** -- Force open via memory, bool.
5753  *   - **access** -- Required access pattern for this file, VipsAccess.
5754  *   - **fail_on** -- Error level to fail on, VipsFailOn.
5755  *
5756  * @param source Source to load from.
5757  * @param options Set of options.
5758  * @return Output image.
5759  */
5760 static VImage webpload_source( VSource source, VOption *options = 0 );
5761 
5762 /**
5763  * Save image to webp file.
5764  *
5765  * **Optional parameters**
5766  *   - **Q** -- Q factor, int.
5767  *   - **lossless** -- enable lossless compression, bool.
5768  *   - **preset** -- Preset for lossy compression, VipsForeignWebpPreset.
5769  *   - **smart_subsample** -- Enable high quality chroma subsampling, bool.
5770  *   - **near_lossless** -- Enable preprocessing in lossless mode (uses Q), bool.
5771  *   - **alpha_q** -- Change alpha plane fidelity for lossy compression, int.
5772  *   - **min_size** -- Optimise for minium size, bool.
5773  *   - **kmin** -- Minimum number of frames between key frames, int.
5774  *   - **kmax** -- Maximum number of frames between key frames, int.
5775  *   - **effort** -- Level of CPU effort to reduce file size, int.
5776  *   - **profile** -- ICC profile to embed, const char *.
5777  *   - **strip** -- Strip all metadata from image, bool.
5778  *   - **background** -- Background value, std::vector<double>.
5779  *   - **page_height** -- Set page height for multipage save, int.
5780  *
5781  * @param filename Filename to save to.
5782  * @param options Set of options.
5783  */
5784 void webpsave( const char *filename, VOption *options = 0 ) const;
5785 
5786 /**
5787  * Save image to webp buffer.
5788  *
5789  * **Optional parameters**
5790  *   - **Q** -- Q factor, int.
5791  *   - **lossless** -- enable lossless compression, bool.
5792  *   - **preset** -- Preset for lossy compression, VipsForeignWebpPreset.
5793  *   - **smart_subsample** -- Enable high quality chroma subsampling, bool.
5794  *   - **near_lossless** -- Enable preprocessing in lossless mode (uses Q), bool.
5795  *   - **alpha_q** -- Change alpha plane fidelity for lossy compression, int.
5796  *   - **min_size** -- Optimise for minium size, bool.
5797  *   - **kmin** -- Minimum number of frames between key frames, int.
5798  *   - **kmax** -- Maximum number of frames between key frames, int.
5799  *   - **effort** -- Level of CPU effort to reduce file size, int.
5800  *   - **profile** -- ICC profile to embed, const char *.
5801  *   - **strip** -- Strip all metadata from image, bool.
5802  *   - **background** -- Background value, std::vector<double>.
5803  *   - **page_height** -- Set page height for multipage save, int.
5804  *
5805  * @param options Set of options.
5806  * @return Buffer to save to.
5807  */
5808 VipsBlob *webpsave_buffer( VOption *options = 0 ) const;
5809 
5810 /**
5811  * Save image to webp target.
5812  *
5813  * **Optional parameters**
5814  *   - **Q** -- Q factor, int.
5815  *   - **lossless** -- enable lossless compression, bool.
5816  *   - **preset** -- Preset for lossy compression, VipsForeignWebpPreset.
5817  *   - **smart_subsample** -- Enable high quality chroma subsampling, bool.
5818  *   - **near_lossless** -- Enable preprocessing in lossless mode (uses Q), bool.
5819  *   - **alpha_q** -- Change alpha plane fidelity for lossy compression, int.
5820  *   - **min_size** -- Optimise for minium size, bool.
5821  *   - **kmin** -- Minimum number of frames between key frames, int.
5822  *   - **kmax** -- Maximum number of frames between key frames, int.
5823  *   - **effort** -- Level of CPU effort to reduce file size, int.
5824  *   - **profile** -- ICC profile to embed, const char *.
5825  *   - **strip** -- Strip all metadata from image, bool.
5826  *   - **background** -- Background value, std::vector<double>.
5827  *   - **page_height** -- Set page height for multipage save, int.
5828  *
5829  * @param target Target to save to.
5830  * @param options Set of options.
5831  */
5832 void webpsave_target( VTarget target, VOption *options = 0 ) const;
5833 
5834 /**
5835  * Make a worley noise image.
5836  *
5837  * **Optional parameters**
5838  *   - **cell_size** -- Size of Worley cells, int.
5839  *   - **seed** -- Random number seed, int.
5840  *
5841  * @param width Image width in pixels.
5842  * @param height Image height in pixels.
5843  * @param options Set of options.
5844  * @return Output image.
5845  */
5846 static VImage worley( int width, int height, VOption *options = 0 );
5847 
5848 /**
5849  * Wrap image origin.
5850  *
5851  * **Optional parameters**
5852  *   - **x** -- Left edge of input in output, int.
5853  *   - **y** -- Top edge of input in output, int.
5854  *
5855  * @param options Set of options.
5856  * @return Output image.
5857  */
5858 VImage wrap( VOption *options = 0 ) const;
5859 
5860 /**
5861  * Make an image where pixel values are coordinates.
5862  *
5863  * **Optional parameters**
5864  *   - **csize** -- Size of third dimension, int.
5865  *   - **dsize** -- Size of fourth dimension, int.
5866  *   - **esize** -- Size of fifth dimension, int.
5867  *
5868  * @param width Image width in pixels.
5869  * @param height Image height in pixels.
5870  * @param options Set of options.
5871  * @return Output image.
5872  */
5873 static VImage xyz( int width, int height, VOption *options = 0 );
5874 
5875 /**
5876  * Make a zone plate.
5877  *
5878  * **Optional parameters**
5879  *   - **uchar** -- Output an unsigned char image, bool.
5880  *
5881  * @param width Image width in pixels.
5882  * @param height Image height in pixels.
5883  * @param options Set of options.
5884  * @return Output image.
5885  */
5886 static VImage zone( int width, int height, VOption *options = 0 );
5887 
5888 /**
5889  * Zoom an image.
5890  * @param xfac Horizontal zoom factor.
5891  * @param yfac Vertical zoom factor.
5892  * @param options Set of options.
5893  * @return Output image.
5894  */
5895 VImage zoom( int xfac, int yfac, VOption *options = 0 ) const;
5896 };
5897 
5898 VIPS_NAMESPACE_END
5899 
5900 #endif /*VIPS_VIMAGE_H*/
5901