Functions¶
Details¶
- Vips.add_option_entries(option_group)¶
- Parameters:
option_group (
GLib.OptionGroup
) – group to add to
Add the standard vips
GLib.OptionEntry
to aGLib.OptionGroup
.See also:
GLib.OptionGroup.new
().
- Vips.area_free_cb(mem, area)¶
- Vips.band_format_is8bit(format)¶
- Parameters:
format (
Vips.BandFormat
) – format to test- Return type:
Return
True
if format is uchar or schar.
- Vips.band_format_iscomplex(format)¶
- Parameters:
format (
Vips.BandFormat
) – format to test- Return type:
Return
True
if fmt is one of the complex types.
- Vips.band_format_isfloat(format)¶
- Parameters:
format (
Vips.BandFormat
) – format to test- Return type:
Return
True
if format is one of the float types.
- Vips.band_format_isint(format)¶
- Parameters:
format (
Vips.BandFormat
) – format to test- Return type:
Return
True
if format is one of the integer types.
- Vips.band_format_isuint(format)¶
- Parameters:
format (
Vips.BandFormat
) – format to test- Return type:
Return
True
if format is one of the unsigned integer types.
- Vips.blob_copy(data)¶
-
Like
Vips.Blob.new
(), but take a copy of the data. Useful for bindings which struggle with callbacks.See also:
Vips.Blob.new
().
- Vips.block_untrusted_set(state)¶
- Parameters:
state (
bool
) – the block state to set
Set the block state on all untrusted operations.
vips_block_untrusted_set(TRUE);
Will block all untrusted operations from running.
Use
vips -l
at the command-line to see the class hierarchy and which operations are marked as untrusted.Set the environment variable
VIPS_BLOCK_UNTRUSTED
to block all untrusted operations onVips.init
().
- Vips.cache_drop_all()¶
Drop the whole operation cache, handy for leak tracking. Also called automatically on
Vips.shutdown
().
- Vips.cache_get_max()¶
- Returns:
the maximum number of operations we keep in cache
- Return type:
Get the maximum number of operations we keep in cache.
- Vips.cache_get_max_files()¶
- Returns:
the maximum number of tracked files we allow
- Return type:
Get the maximum number of tracked files we allow before we start dropping cached operations. See
Vips.tracked_get_files
().libvips only tracks file descriptors it allocates, it can’t track ones allocated by external libraries. If you use an operation like vips_magickload(), most of the descriptors it uses won’t be included.
See also:
Vips.tracked_get_files
().
- Vips.cache_get_max_mem()¶
- Returns:
the maximum amount of tracked memory we allow
- Return type:
Get the maximum amount of tracked memory we allow before we start dropping cached operations. See
Vips.tracked_get_mem
().See also:
Vips.tracked_get_mem
().
- Vips.cache_get_size()¶
- Returns:
get the current number of operations in cache.
- Return type:
Get the current number of operations in cache.
- Vips.cache_operation_build(operation)¶
- Parameters:
operation (
Vips.Operation
) – operation to lookup- Returns:
The built operation.
- Return type:
A binding-friendly version of vips_cache_operation_buildp().
After calling this, operation has the same ref count as when it went in, and the result must be freed with
Vips.Object.unref_outputs
() andGObject.Object.unref
().
- Vips.cache_print()¶
Print the whole operation cache to stdout. Handy for debugging.
- Vips.cache_set_dump(dump)¶
-
Handy for debugging. Print the operation cache to stdout just before exit.
See also:
Vips.cache_set_trace
().
- Vips.cache_set_max(max)¶
- Parameters:
max (
int
) – maximum number of operation to cache
Set the maximum number of operations we keep in cache.
- Vips.cache_set_max_files(max_files)¶
- Parameters:
max_files (
int
) – max open files we allow
Set the maximum number of tracked files we allow before we start dropping cached operations. See
Vips.tracked_get_files
().See also:
Vips.tracked_get_files
().
- Vips.cache_set_max_mem(max_mem)¶
- Parameters:
max_mem (
int
) – maximum amount of tracked memory we use
Set the maximum amount of tracked memory we allow before we start dropping cached operations. See
Vips.tracked_get_mem
().libvips only tracks memory it allocates, it can’t track memory allocated by external libraries. If you use an operation like vips_magickload(), most of the memory it uses won’t be included.
See also:
Vips.tracked_get_mem
().
- Vips.cache_set_trace(trace)¶
-
Handy for debugging. Print operation cache actions to stdout as we run.
You can set the environment variable
VIPS_TRACE
to turn this option on, or use the command-line flag--vips-cache-trace
.See also:
Vips.cache_set_dump
().
- Vips.call_argv(operation, argc, argv)¶
- Parameters:
operation (
Vips.Operation
) –argc (
int
) –argv (
str
) –
- Return type:
- Vips.call_options(group, operation)¶
- Parameters:
group (
GLib.OptionGroup
) –operation (
Vips.Operation
) –
- Vips.check_8or16(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image is 8 or 16-bit integer, signed or unsigned. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_bandno(domain, im, bandno)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to checkbandno (
int
) – band number
- Returns:
0 if OK, -1 otherwise.
- Return type:
bandno should be a valid band number (ie. 0 to im->Bands - 1), or can be -1, meaning all bands. If not, set an error message and return non-zero.
See also: vips_error().
- Vips.check_bands(domain, im, bands)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to checkbands (
int
) – must have this many bands
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image has bands bands. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_bands_1or3(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image has either one or three bands. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_bands_1orn(domain, im1, im2)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim1 (
Vips.Image
) – first image to checkim2 (
Vips.Image
) – second image to check
- Returns:
0 on OK, or -1 on error.
- Return type:
Check that the images have the same number of bands, or that one of the images has just 1 band. If not, set an error message and return non-zero.
See also: vips_error().
- Vips.check_bands_1orn_unary(domain, im, n)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to checkn (
int
) – number of bands, or 1
- Returns:
0 on OK, or -1 on error.
- Return type:
Check that an image has 1 or n bands. Handy for unary operations, cf.
Vips.check_bands_1orn
(). If not, set an error message and return non-zero.See also:
Vips.check_bands_1orn
().
- Vips.check_bands_atleast(domain, im, bands)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to checkbands (
int
) – at least this many bands
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image has at least bands bands. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_bands_same(domain, im1, im2)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim1 (
Vips.Image
) – first image to checkim2 (
Vips.Image
) – second image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the images have the same number of bands. If not, set an error message and return non-zero.
See also: vips_error().
- Vips.check_coding(domain, im, coding)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to checkcoding (
Vips.Coding
) – required coding
- Returns:
0 on OK, or -1 on error.
- Return type:
Check that the image has the required coding. If not, set an error message and return non-zero.
See also: vips_error().
- Vips.check_coding_known(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 on OK, or -1 on error.
- Return type:
Check that the image is uncoded, LABQ coded or RAD coded. If not, set an error message and return non-zero.
See also: vips_error().
- Vips.check_coding_noneorlabq(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 on OK, or -1 on error.
- Return type:
Check that the image is uncoded or LABQ coded. If not, set an error message and return non-zero.
See also: vips_error().
- Vips.check_coding_same(domain, im1, im2)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim1 (
Vips.Image
) – first image to checkim2 (
Vips.Image
) – second image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the images have the same coding. If not, set an error message and return non-zero.
See also: vips_error().
- Vips.check_complex(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image is complex. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_format(domain, im, fmt)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to checkfmt (
Vips.BandFormat
) – format to test for
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image has the specified format. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_format_same(domain, im1, im2)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim1 (
Vips.Image
) – first image to checkim2 (
Vips.Image
) – second image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the images have the same format. If not, set an error message and return non-zero.
See also: vips_error().
- Vips.check_hist(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Histogram images must have width or height 1, and must not have more than 65536 elements. Return 0 if the image will pass as a histogram, or -1 and set an error message otherwise.
See also: vips_error().
- Vips.check_int(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image is in one of the integer formats. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_matrix(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- out:
put image as in-memory doubles here
- Return type:
(
int
, out:Vips.Image
)
Matrix images must have width and height less than 100000 and have 1 band.
Return 0 if the image will pass as a matrix, or -1 and set an error message otherwise.
out is set to be im cast to double and stored in memory. Use VIPS_MATRIX() to address values in out.
You must unref out when you are done with it.
See also: VIPS_MATRIX(), vips_object_local()
- Vips.check_mono(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image has exactly one band. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_noncomplex(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image is not complex. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_oddsquare(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image is square and that the sides are odd. If not, set an error message and return non-zero.
See also: vips_error().
- Vips.check_precision_intfloat(domain, precision)¶
- Parameters:
domain (
str
) – the originating domain for the error messageprecision (
Vips.Precision
) – precision to check
- Returns:
0 on OK, or -1 on error.
- Return type:
Check that prec image is either float or int. If not, set an error message and return non-zero.
See also: vips_error().
- Vips.check_separable(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Separable matrix images must have width or height 1. Return 0 if the image will pass, or -1 and set an error message otherwise.
See also: vips_error().
- Vips.check_size_same(domain, im1, im2)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim1 (
Vips.Image
) – first image to checkim2 (
Vips.Image
) – second image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the images have the same size. If not, set an error message and return non-zero.
See also: vips_error().
- Vips.check_twocomponents(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image is has two “components”, ie. is a one-band complex or a two-band non-complex. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_u8or16(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image is 8 or 16-bit unsigned integer. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_u8or16orf(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image is 8 or 16-bit unsigned integer, or float. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_uint(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image is in one of the unsigned integer formats. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_uintorf(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that the image is unsigned int or float. Otherwise set an error message and return non-zero.
See also: vips_error().
- Vips.check_uncoded(domain, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messageim (
Vips.Image
) – image to check
- Returns:
0 on OK, or -1 on error.
- Return type:
Check that the image is not coded. If not, set an error message and return non-zero.
See also: vips_error().
- Vips.check_vector(domain, n, im)¶
- Parameters:
domain (
str
) – the originating domain for the error messagen (
int
) – number of elements in vectorim (
Vips.Image
) – image to check against
- Returns:
0 if OK, -1 otherwise.
- Return type:
Operations with a vector constant need a 1-element vector, or a vector with the same number of elements as there are bands in the image, or a 1-band image and a many-element vector.
See also: vips_error().
- Vips.check_vector_length(domain, n, len)¶
- Parameters:
- Returns:
0 if OK, -1 otherwise.
- Return type:
Check that n == len.
See also: vips_error().
- Vips.class_find(basename, nickname)¶
- Parameters:
- Returns:
the found class.
- Return type:
Search below basename, return the first class whose name or nickname matches.
See also:
Vips.type_find
()
- Vips.col_C2Ccmc(C)¶
-
Calculate Ccmc from C.
- Vips.col_Ccmc2C(Ccmc)¶
-
Calculate C from Ccmc using a table. Call
Vips.col_make_tables_CMC
() at least once before using this function.
- Vips.col_Ch2ab(C, h, a, b)¶
- Parameters:
Calculate ab from Ch, h in degrees.
- Vips.col_Ch2hcmc(C, h)¶
-
Calculate hcmc from C and h.
- Vips.col_Chcmc2h(C, hcmc)¶
-
Calculate h from C and hcmc, using a table. Call
Vips.col_make_tables_CMC
() at least once before using this function.
- Vips.col_L2Lcmc(L)¶
-
Calculate Lcmc from L.
- Vips.col_Lab2XYZ(L, a, b)¶
- Parameters:
- Returns:
- X:
Return CIE XYZ colour
- Y:
Return CIE XYZ colour
- Z:
Return CIE XYZ colour
- Return type:
Calculate XYZ from Lab, D65.
See also: vips_Lab2XYZ().
- Vips.col_Lcmc2L(Lcmc)¶
-
Calculate L from Lcmc using a table. Call
Vips.col_make_tables_CMC
() at least once before using this function.
- Vips.col_XYZ2Lab(X, Y, Z)¶
- Parameters:
- Returns:
- L:
Return CIE Lab value
- a:
Return CIE Lab value
- b:
Return CIE Lab value
- Return type:
Calculate XYZ from Lab, D65.
See also: vips_XYZ2Lab().
- Vips.col_XYZ2scRGB(X, Y, Z)¶
- Parameters:
- Returns:
- R:
Return scRGB colour
- G:
Return scRGB colour
- B:
Return scRGB colour
- Return type:
Turn XYZ into scRGB.
See also: vips_XYZ2scRGB().
- Vips.col_ab2h(a, b)¶
- Vips.col_dE00(L1, a1, b1, L2, a2, b2)¶
- Parameters:
- Returns:
CIE dE2000 colour difference.
- Return type:
CIEDE2000, from:
Luo, Cui, Rigg, “The Development of the CIE 2000 Colour-Difference Formula: CIEDE2000”, COLOR research and application, pp 340
- Vips.col_make_tables_CMC()¶
Make the lookup tables for cmc.
- Vips.col_sRGB2scRGB_16(r, g, b, R, G, B)¶
- Vips.col_sRGB2scRGB_16_noclip(r, g, b, R, G, B)¶
- Vips.col_sRGB2scRGB_8(r, g, b, R, G, B)¶
- Vips.col_sRGB2scRGB_8_noclip(r, g, b, R, G, B)¶
- Vips.col_scRGB2BW_16(R, G, B, g, og)¶
- Vips.col_scRGB2BW_8(R, G, B, g, og)¶
- Vips.col_scRGB2XYZ(R, G, B)¶
- Parameters:
- Returns:
- X:
Return XYZ colour
- Y:
Return XYZ colour
- Z:
Return XYZ colour
- Return type:
Turn scRGB into XYZ.
See also: vips_scRGB2XYZ().
- Vips.col_scRGB2sRGB_16(R, G, B, r, g, b, og)¶
- Vips.col_scRGB2sRGB_8(R, G, B, r, g, b, og)¶
- Vips.concurrency_get()¶
- Returns:
number of worker threads to use.
- Return type:
Returns the number of worker threads that vips should use when running a #VipsThreadPool.
vips gets this values from these sources in turn:
If
Vips.concurrency_set
() has been called, this value is used. The special value 0 means “default”. You can also use the command-line argument “–vips-concurrency” to set this value.If
Vips.concurrency_set
() has not been called and no command-line argument was used, vips uses the value of the environment variable VIPS_CONCURRENCY,If VIPS_CONCURRENCY has not been set, vips finds the number of hardware threads that the host machine can run in parallel and uses that value.
The final value is clipped to the range 1 - 1024.
See also:
Vips.concurrency_get
().
- Vips.concurrency_set(concurrency)¶
- Parameters:
concurrency (
int
) – number of threads to run
Sets the number of worker threads that vips should use when running a #VipsThreadPool.
The special value 0 means “default”. In this case, the number of threads is set by the environment variable VIPS_CONCURRENCY, or if that is not set, the number of threads available on the host machine.
See also:
Vips.concurrency_get
().
- Vips.error_buffer()¶
- Returns:
the error buffer as a C string which must not be freed
- Return type:
Get a pointer to the start of the error buffer as a C string. The string is owned by the error system and must not be freed.
See also:
Vips.error_clear
().
- Vips.error_buffer_copy()¶
- Returns:
a copy of the libvips error buffer
- Return type:
Return a copy of the vips error buffer, and clear it.
- Vips.error_clear()¶
Clear and reset the error buffer. This is typically called after presenting an error to the user.
See also:
Vips.error_buffer
().
- Vips.error_freeze()¶
Stop errors being logged. Use
Vips.error_thaw
() to unfreeze. You can nest freeze/thaw pairs.
- Vips.error_g()¶
- Raises:
This function sets the glib error pointer from the vips error buffer and clears it. It’s handy for returning errors to glib functions from vips.
See
Vips.g_error
() for the inverse operation.See also: g_set_error(),
Vips.g_error
().
- Vips.error_thaw()¶
Re-enable error logging.
- Vips.filename_get_filename(vips_filename)¶
- Parameters:
vips_filename (
str
) – a filename including a set of options- Returns:
transfer full: just the filename component.
- Return type:
Given a vips filename like “fred.jpg[Q=90]”, return a new string of just the filename part, “fred.jpg” in this case.
Useful for language bindings.
See also:
Vips.filename_get_options
().
- Vips.filename_get_options(vips_filename)¶
- Parameters:
vips_filename (
str
) – a filename including a set of options- Returns:
transfer full: just the options component.
- Return type:
Given a vips filename like “fred.jpg[Q=90]”, return a new string of just the options part, “[Q=90]” in this case.
Useful for language bindings.
See also:
Vips.filename_get_filename
().
- Vips.foreign_flags(loader, filename)¶
- Parameters:
- Returns:
the flags for filename.
- Return type:
Return the flags for filename using loader. loader is something like “tiffload” or “VipsForeignLoadTiff”.
- Vips.format_sizeof(format)¶
- Parameters:
format (
Vips.BandFormat
) – format type- Returns:
number of bytes for a band format.
- Return type:
- Vips.g_error()¶
- Raises:
This function adds the
GLib.Error
to the vips error buffer and clears it. It’s the opposite ofVips.error_g
().See also:
Vips.error_g
().
- Vips.get_argv0()¶
- Returns:
a pointer to an internal copy of the argv0 string passed to VIPS_INIT(). Do not free this value
- Return type:
See also: VIPS_INIT().
- Vips.get_disc_threshold()¶
- Returns:
disc threshold in bytes.
- Return type:
Return the number of bytes at which we flip between open via memory and open via disc. This defaults to 100mb, but can be changed with the VIPS_DISC_THRESHOLD environment variable or the –vips-disc-threshold command-line flag. See vips_image_new_from_file().
- Vips.get_prgname()¶
- Returns:
a pointer to an internal copy of the program name. Do not free this value
- Return type:
Return the program name. This can be useful for the user tio see,.
See also: VIPS_INIT().
- Vips.guess_libdir(argv0, env_name)¶
- Parameters:
- Returns:
the libdir as a static string, do not free.
- Return type:
Vips.guess_libdir
() tries to guess the install directory (usually the configure libdir, or $prefix/lib). You should pass in the value of argv[0] (the name your program was run as) as a clue to help it out, plus the name of the environment variable you let the user override your package install area with (eg. “VIPSHOME”).On success,
Vips.guess_libdir
() returns the libdir it discovered, and as a side effect, sets the prefix environment variable (if it’s not set).Don’t free the return string!
See also:
Vips.guess_prefix
().
- Vips.guess_prefix(argv0, env_name)¶
- Parameters:
- Returns:
the install prefix as a static string, do not free.
- Return type:
Vips.guess_prefix
() tries to guess the install directory. You should pass in the value of argv[0] (the name your program was run as) as a clue to help it out, plus the name of the environment variable you let the user override your package install area with (eg. “VIPSHOME”).On success,
Vips.guess_prefix
() returns the prefix it discovered, and as a side effect, sets the environment variable (if it’s not set).Don’t free the return string!
See also:
Vips.guess_libdir
().
- Vips.icc_is_compatible_profile(image, data, data_length)¶
- Parameters:
image (
Vips.Image
) –data_length (
int
) –
- Return type:
- Vips.icc_present()¶
- Returns:
non-zero if the ICC library is present.
- Return type:
VIPS can optionally be built without the ICC library. Use this function to test for its availability.
- Vips.init(argv0)¶
-
This function starts up libvips, see VIPS_INIT().
This function is for bindings which need to start up vips. C programs should use the VIPS_INIT() macro, which does some extra checks.
See also: VIPS_INIT().
- Vips.interpretation_max_alpha(interpretation)¶
- Parameters:
interpretation (
Vips.Interpretation
) – image interpretation- Returns:
the maximum alpha value for an interpretation.
- Return type:
- Vips.leak_set(leak)¶
- Parameters:
leak (
bool
) – turn leak checking on or off
Turn on or off vips leak checking. See also –vips-leak,
Vips.add_option_entries
() and theVIPS_LEAK
environment variable.You should call this very early in your program.
- Vips.malloc(object, size)¶
- Parameters:
object (
Vips.Object
orNone
) – allocate memory local to thisVips.Object
, orNone
size (
int
) – number of bytes to allocate
- Returns:
a pointer to the allocated memory.
- Return type:
GLib.malloc
() local to object, that is, the memory will be automatically freed for you when the object is closed. If object isNone
, you need to free the memory explicitly withGLib.free
().This function cannot fail. See
Vips.tracked_malloc
() if you are allocating large amounts of memory.See also:
Vips.tracked_malloc
().
- Vips.nickname_find(type)¶
- Parameters:
type (
GObject.GType
) –GObject.GType
to search for- Returns:
the class nickname.
- Return type:
Return the VIPS nickname for a
GObject.GType
. Handy for language bindings.
- Vips.path_filename7(path)¶
-
Return the filename part of a vips7 path. For testing only.
- Vips.path_mode7(path)¶
-
Return the mode part of a vips7 path. For testing only.
- Vips.progress_set(progress)¶
-
If set, vips will print messages about the progress of computation to stdout. This can also be enabled with the –vips-progress option, or by setting the environment variable VIPS_PROGRESS.
- Vips.pythagoras(L1, a1, b1, L2, a2, b2)¶
- Parameters:
- Return type:
Pythagorean distance between two points in colour space. Lab/XYZ/CMC etc.
- Vips.shutdown()¶
Call this to drop caches, close plugins, terminate background threads, and finalize any internal library testing.
Vips.shutdown
() is optional. If you don’t call it, your platform will clean up for you. The only negative consequences are that the leak checker and the profiler will not work.You may call VIPS_INIT() many times and
Vips.shutdown
() many times, but you must not call VIPS_INIT() afterVips.shutdown
(). In other words, you cannot stop and restart libvips.See also: vips_profile_set(),
Vips.leak_set
().
- Vips.strdup(object, str)¶
- Parameters:
object (
Vips.Object
orNone
) – allocate memory local to thisVips.Object
, orNone
str (
str
) – string to copy
- Returns:
a pointer to the allocated memory
- Return type:
GLib.strdup
() a string. When object is freed, the string will be freed for you. If object isNone
, you need to free the memory yourself withGLib.free
().This function cannot fail.
See also:
Vips.malloc
().
- Vips.thread_shutdown()¶
Free any thread-private data and flush any profiling information.
This function needs to be called when a thread that has been using vips exits. It is called for you by
Vips.shutdown
() and for any threads created within the #VipsThreadPool.You will need to call it from threads created in other ways or there will be memory leaks. If you do not call it, vips will generate a warning message.
It may be called many times, and you can continue using vips after calling it. Calling it too often will reduce performance.
- Vips.tracked_aligned_alloc(size, align)¶
- Parameters:
- Returns:
a pointer to the allocated memory, or
None
on error.- Return type:
Allocate an area of memory aligned on a boundary specified by align that will be tracked by
Vips.tracked_get_mem
() and friends.If allocation fails,
Vips.tracked_aligned_alloc
() returnsNone
and sets an error message.You must only free the memory returned with
Vips.tracked_aligned_free
().See also:
Vips.tracked_malloc
(),Vips.tracked_aligned_free
(),Vips.malloc
().
- Vips.tracked_aligned_free(s)¶
-
Only use it to free memory that was previously allocated with
Vips.tracked_aligned_alloc
() with aNone
first argument.See also:
Vips.tracked_aligned_alloc
().
- Vips.tracked_close(fd)¶
-
Exactly as close(2), but update the number of files currently open via
Vips.tracked_get_files
(). This is used by the vips operation cache to drop cache when the number of files available is low.You must only close file descriptors opened with
Vips.tracked_open
().See also:
Vips.tracked_open
(),Vips.tracked_get_files
().
- Vips.tracked_free(s)¶
-
Only use it to free memory that was previously allocated with
Vips.tracked_malloc
() with aNone
first argument.See also:
Vips.tracked_malloc
().
- Vips.tracked_get_allocs()¶
- Returns:
the number of active allocations
- Return type:
Returns the number of active allocations.
- Vips.tracked_get_files()¶
- Returns:
the number of open files
- Return type:
Returns the number of open files.
- Vips.tracked_get_mem()¶
- Returns:
the number of currently allocated bytes
- Return type:
Returns the number of bytes currently allocated via
Vips.malloc
() and friends. vips uses this figure to decide when to start dropping cache, seeVips.Operation
.
- Vips.tracked_get_mem_highwater()¶
- Returns:
the largest number of currently allocated bytes
- Return type:
Returns the largest number of bytes simultaneously allocated via
Vips.tracked_malloc
(). Handy for estimating max memory requirements for a program.
- Vips.tracked_malloc(size)¶
- Parameters:
size (
int
) – number of bytes to allocate- Returns:
a pointer to the allocated memory, or
None
on error.- Return type:
Allocate an area of memory that will be tracked by
Vips.tracked_get_mem
() and friends.If allocation fails,
Vips.tracked_malloc
() returnsNone
and sets an error message.You must only free the memory returned with
Vips.tracked_free
().See also:
Vips.tracked_free
(),Vips.malloc
().
- Vips.tracked_open(pathname, flags, mode)¶
- Parameters:
- Returns:
a file descriptor, or -1 on error.
- Return type:
Exactly as open(2), but the number of files currently open via
Vips.tracked_open
() is available viaVips.tracked_get_files
(). This is used by the vips operation cache to drop cache when the number of files available is low.You must only close the file descriptor with
Vips.tracked_close
().pathname should be utf8.
See also:
Vips.tracked_close
(),Vips.tracked_get_files
().
- Vips.type_depth(type)¶
- Parameters:
type (
GObject.GType
) –- Return type:
- Vips.type_find(basename, nickname)¶
- Parameters:
- Returns:
the
GObject.GType
of the class, or 0 if the class is not found.- Return type:
Search below basename, return the
GObject.GType
of the class whose name or nickname matches, or 0 for not found. If basename isNone
, the whole ofVips.Object
is searched.This function uses a cache, so it should be quick.
See also:
Vips.class_find
()
- Vips.value_get_area(value)¶
- Parameters:
value (
GObject.Value
) – get from this value- Returns:
The pointer held by value.
- length:
optionally return length here
- Return type:
Get the pointer from an area. Don’t touch count (area is static).
- Vips.value_get_array(value)¶
- Parameters:
value (
GObject.Value
) –GObject.Value
to get from- Returns:
The array address.
- n:
return the number of elements here, optionally
- type:
return the type of each element here, optionally
- sizeof_type:
return the sizeof each element here, optionally
- Return type:
(
object
orNone
, n:int
, type:GObject.GType
, sizeof_type:int
)
Return the pointer to the array held by value. Optionally return the other properties of the array in n, type, sizeof_type.
See also:
Vips.value_set_array
().
- Vips.value_get_array_double(value)¶
- Parameters:
value (
GObject.Value
) –GObject.Value
to get from- Returns:
The array address.
- Return type:
[
float
]
Return the start of the array of doubles held by value. optionally return the number of elements in n.
See also:
Vips.ArrayDouble.new
().
- Vips.value_get_array_image(value)¶
- Parameters:
value (
GObject.Value
) –GObject.Value
to get from- Returns:
The array address.
- Return type:
Return the start of the array of images held by value. optionally return the number of elements in n.
See also:
Vips.value_set_array_image
().
- Vips.value_get_array_int(value)¶
- Parameters:
value (
GObject.Value
) –GObject.Value
to get from- Returns:
The array address.
- Return type:
[
int
]
Return the start of the array of ints held by value. optionally return the number of elements in n.
See also:
Vips.ArrayInt.new
().
- Vips.value_get_blob(value)¶
- Parameters:
value (
GObject.Value
) –GObject.Value
to set- Returns:
The pointer held by value.
- Return type:
Returns the data pointer from a blob. Optionally returns the length too.
blobs are things like ICC profiles or EXIF data. They are relocatable, and are saved to VIPS files for you coded as base64 inside the XML. They are copied by copying reference-counted pointers.
See also:
Vips.value_set_blob
()
- Vips.value_get_ref_string(value)¶
- Parameters:
value (
GObject.Value
) –GObject.Value
to get from- Returns:
The C string held by value.
- length:
return length here, optionally
- Return type:
Get the C string held internally by the
GObject.Value
.
- Vips.value_get_save_string(value)¶
- Parameters:
value (
GObject.Value
) –GObject.Value
to get from- Returns:
The C string held by value.
- Return type:
Get the C string held internally by the
GObject.Value
.
- Vips.value_is_null(psoec, value)¶
- Parameters:
psoec (
GObject.ParamSpec
) –value (
GObject.Value
) –
- Return type:
- Vips.value_set_area(value, free_fn, *data)¶
- Parameters:
value (
GObject.Value
) – set this valuefree_fn (
Vips.CallbackFn
orNone
) – data will be freed with this function
Set value to be a ref-counted area of memory with a free function.
- Vips.value_set_array(n, type, sizeof_type)¶
- Parameters:
n (
int
) – number of elementstype (
GObject.GType
) – the type of each elementsizeof_type (
int
) – the sizeof each element
- Returns:
GObject.Value
to set- Return type:
value:
GObject.Value
Set value to be an array of things.
This allocates memory but does not initialise the contents: get the pointer and write instead.
- Vips.value_set_array_double(value, array)¶
- Parameters:
value (
GObject.Value
) –GObject.Value
to get from
Set value to hold a copy of array. Pass in the array length in n.
See also:
Vips.ArrayDouble.get
().
- Vips.value_set_array_image(value, n)¶
- Parameters:
value (
GObject.Value
) –GObject.Value
to get fromn (
int
) – the number of elements
Set value to hold an array of images. Pass in the array length in n.
See also:
Vips.ArrayImage.get
().
- Vips.value_set_array_int(value, array)¶
- Parameters:
value (
GObject.Value
) –GObject.Value
to get from
Set value to hold a copy of array. Pass in the array length in n.
See also:
Vips.ArrayInt.get
().
- Vips.value_set_array_object(n)¶
- Parameters:
n (
int
) – the number of elements- Returns:
GObject.Value
to set- Return type:
value:
GObject.Value
Set value to hold an array of
GObject.Object
. Pass in the array length in n.See also: vips_value_get_array_object().
- Vips.value_set_blob(free_fn, data)¶
- Parameters:
free_fn (
Vips.CallbackFn
orNone
) – free function for datadata (
bytes
) – pointer to area of memory
- Returns:
GObject.Value
to set- Return type:
value:
GObject.Value
Sets value to hold a data. When value is freed, data will be freed with free_fn. value also holds a note of the size of the memory area.
blobs are things like ICC profiles or EXIF data. They are relocatable, and are saved to VIPS files for you coded as base64 inside the XML. They are copied by copying reference-counted pointers.
See also:
Vips.value_get_blob
()
- Vips.value_set_blob_free(value, data)¶
- Parameters:
value (
GObject.Value
) –GObject.Value
to setdata (
bytes
) – pointer to area of memory
Just like
Vips.value_set_blob
(), but when value is freed, data will be freed withGLib.free
().This can be easier to call for language bindings.
See also:
Vips.value_set_blob
()
- Vips.value_set_ref_string(str)¶
- Parameters:
str (
str
) – C string to copy into theGObject.Value
- Returns:
GObject.Value
to set- Return type:
value:
GObject.Value
Copies the C string str into value.
vips_ref_string are immutable C strings that are copied between images by copying reference-counted pointers, making them much more efficient than regular
GObject.Value
strings.str should be a valid utf-8 string.
- Vips.value_set_save_string(str)¶
- Parameters:
str (
str
) – C string to copy into theGObject.Value
- Returns:
GObject.Value
to set- Return type:
value:
GObject.Value
Copies the C string into value.
str should be a valid utf-8 string.