Movatterモバイル変換


[0]ホーム

URL:


libvips

A fast image processing library with low memory needs.

DownloadInstallDocumentationIssuesWikilibvips projectslibvips on GitHub
Top  | DescriptionHomeUpPrevNext

vips

vips — startup, shutdown, version

Stability Level

Stable, unless otherwise indicated

Functions

#defineVIPS_INIT()
intvips_max_coord_get ()
intvips_init ()
constchar *vips_get_argv0 ()
constchar *vips_get_prgname ()
voidvips_shutdown ()
voidvips_thread_shutdown ()
voidvips_add_option_entries ()
voidvips_leak_set ()
voidvips_block_untrusted_set ()
constchar *vips_version_string ()
intvips_version ()
constchar *vips_guess_prefix ()
constchar *vips_guess_libdir ()

Includes

#include <vips/vips.h>

Description

Start VIPS up, shut VIPS down, get version information, relocation.

VIPS is a relocatable package, meaning you can move the directory tree youcompiled it to at runtime and it will still be able to find all data files.This is required for OS X and Windows, but slightly unusual in the Unixworld. Seevips_init() andvips_guess_prefix().

Functions

VIPS_INIT()

#define             VIPS_INIT(ARGV0)

VIPS_INIT() starts up the world of VIPS. You should call this onprogram startup before using any other VIPS operations. If you do not callVIPS_INIT(), VIPS will call it for you when you use your first VIPSoperation, but it may not be able to get hold ofARGV0 and VIPS maytherefore be unable to find its data files. It is much better to callthis macro yourself.

ARGV0 is used to help discover message catalogues if libvips has beenrelocated. If you don't need a relocatable package, you can just pass""and it'll be fine.

Additionally,VIPS_INIT() can be run from any thread, but it must not becalled from more than one thread at the same time. This is much easier toguarantee if you call it yourself.

VIPS_INIT() is a macro, since it tries to check ABI compatibilitybetween the caller and the library. You can also callvips_init(), thenon-macro version, if macros are not available to you.

You may callVIPS_INIT() many times andvips_shutdown() many times, but youmust not callVIPS_INIT() aftervips_shutdown(). In other words, you cannotstop and restart vips.

Use the environment variableVIPS_MIN_STACK_SIZE to set the minimum stacksize. For example,2m for a minimum of two megabytes of stack. This canbe important for systems like musl where the default stack is very small.

VIPS_INIT() does approximately the following:

  • checks that the libvips your program is expecting isbinary-compatible with the vips library you're running against

  • sets a minimum stack size, see above

  • initialises any libraries that VIPS is using, including GObjectand the threading system, if necessary

  • guesses where the VIPS data files are and sets upinternationalisation --- seevips_guess_prefix()

  • creates the main vips types, includingVipsImage and friends

  • loads any plugins from $libdir/vips-x.y/, where x and y are themajor and minor version numbers for this VIPS.

Example:

123456789
intmain(intargc,char**argv){if(VIPS_INIT(argv[0]))vips_error_exit("unable to start VIPS");vips_shutdown();return0;}

See also:vips_shutdown(),vips_add_option_entries(),vips_version(),vips_guess_prefix(),vips_guess_libdir().

Parameters

ARGV0

name of application

 

Returns

0 on success, -1 otherwise


vips_max_coord_get ()

intvips_max_coord_get (void);

Return the maximum coordinate value. This can be the default, a value setset by the--vips-max-coord CLI arg, or a value set in theVIPS_MAX_COORDenvironment variable.

These strings can include unit specifiers, eg. "10m" for 10 million pixels.Values above INT_MAX are not supported.

Returns

The maximum value a coordinate, or image dimension, can have.


vips_init ()

intvips_init (constchar *argv0);

This function starts up libvips, seeVIPS_INIT().

This function is for bindings which need to start up vips. C programsshould use theVIPS_INIT() macro, which does some extra checks.

See also:VIPS_INIT().

Parameters

argv0

name of application

 

Returns

0 on success, -1 otherwise


vips_get_argv0 ()

constchar *vips_get_argv0 (void);

See also:VIPS_INIT().

Returns

a pointer to an internal copy of theargv0 string passed toVIPS_INIT(). Do not free this value.

[transfer none]


vips_get_prgname ()

constchar *vips_get_prgname (void);

Return the program name. This can be useful for the user tio see,.

See also:VIPS_INIT().

Returns

a pointer to an internal copy of the programname. Do not free this value.

[transfer none]


vips_shutdown ()

voidvips_shutdown (void);

Call this to drop caches, close plugins, terminate background threads, andfinalize any internal library testing.

vips_shutdown() is optional. If you don't call it, your platform willclean up for you. The only negative consequences are that the leak checkerand the profiler will not work.

You may callVIPS_INIT() many times andvips_shutdown() many times, but youmust not callVIPS_INIT() aftervips_shutdown(). In other words, you cannotstop and restart libvips.

See also:vips_profile_set(),vips_leak_set().


vips_thread_shutdown ()

voidvips_thread_shutdown (void);

Free any thread-private data and flush any profiling information.

This function needs to be called when a thread that has been using vipsexits. It is called for you byvips_shutdown() and for any threads createdwithin theVipsThreadPool.

You will need to call it from threads created inother ways or there will be memory leaks. If you do not call it, vipswill generate a warning message.

It may be called many times, and you can continue using vips aftercalling it. Calling it too often will reduce performance.


vips_add_option_entries ()

voidvips_add_option_entries (GOptionGroup *option_group);

Add the standard vipsGOptionEntry to aGOptionGroup.

See also:g_option_group_new().

Parameters

option_group

group to add to

 

vips_leak_set ()

voidvips_leak_set (gboolean leak);

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.

Parameters

leak

turn leak checking on or off

 

vips_block_untrusted_set ()

voidvips_block_untrusted_set (gboolean state);

Set the block state on all untrusted operations.

1
vips_block_untrusted_set(TRUE);

Will block all untrusted operations from running.

Usevips -l at the command-line to see the class hierarchy and whichoperations are marked as untrusted.

Set the environment variableVIPS_BLOCK_UNTRUSTED to block all untrustedoperations onvips_init().

Parameters

state

the block state to set

 

vips_version_string ()

constchar *vips_version_string (void);

Get the VIPS version as a static string, including a build date and time.Do not free.

Returns

a static version string.

[transfer none]


vips_version ()

intvips_version (int flag);

Get the major, minor or micro library version, withflag values 0, 1 and2.

Get the ABI current, revision and age (as used by Meson) withflagvalues 3, 4, 5.

Parameters

flag

which field of the version to get

 

Returns

library version number


vips_guess_prefix ()

constchar *vips_guess_prefix (constchar *argv0,constchar *env_name);

vips_guess_prefix() tries to guess the install directory. You should passin the value of argv[0] (the name your program was run as) as a clue tohelp it out, plus the name of the environment variable you let the useroverride your package install area with (eg. "VIPSHOME").

On success,vips_guess_prefix() returns the prefix it discovered, and as aside effect, sets the environment variable (if it's not set).

Don't free the return string!

See also:vips_guess_libdir().

Parameters

argv0

program name (typically argv[0])

 

env_name

save prefix in this environment variable

 

Returns

the install prefix as a static string, do not free.

[transfer none]


vips_guess_libdir ()

constchar *vips_guess_libdir (constchar *argv0,constchar *env_name);

vips_guess_libdir() tries to guess the install directory (usually theconfigure libdir, or $prefix/lib). You should passin the value of argv[0] (the name your program was run as) as a clue tohelp it out, plus the name of the environment variable you let the useroverride your package install area with (eg. "VIPSHOME").

On success,vips_guess_libdir() returns the libdir it discovered, and as aside effect, sets the prefix environment variable (if it's not set).

Don't free the return string!

See also:vips_guess_prefix().

Parameters

argv0

program name (typically argv[0])

 

env_name

save prefix in this environment variable

 

Returns

the libdir as a static string, do not free.

[transfer none]

See Also

VipsOperation

Generated by GTK-Doc V1.34.0

[8]ページ先頭

©2009-2025 Movatter.jp