Class NetVips
Basic utility stuff.
Inherited Members
Namespace: NetVips
Assembly: NetVips.dll
Syntax
public static class NetVips
Properties
BlockUntrusted
Set the block state on all untrusted operations.
Declaration
public static bool BlockUntrusted { set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
For example:
NetVips.BlockUntrusted = 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. Use Block(string, bool) to set the block state on specific operations in the libvips class hierarchy.
At least libvips 8.13 is needed.
Concurrency
Gets or sets the number of worker threads libvips' should create to process each image.
Declaration
public static int Concurrency { get; set; }
Property Value
Type | Description |
---|---|
int |
Leak
Enable or disable libvips leak checking.
Declaration
public static bool Leak { set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
With this enabled, libvips will check for object and area leaks on Shutdown(). Enabling this option will make libvips run slightly more slowly.
Profile
Enable or disable libvips profile recording.
Declaration
public static bool Profile { set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
If set, vips will record profiling information, and dump it on Shutdown().
These profiles can be analyzed with the vipsprofile
program.
Vector
Enable or disable SIMD.
Declaration
public static bool Vector { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
AtLeastLibvips(int, int, int)
Is this at least libvips major.minor[.patch]?
Declaration
public static bool AtLeastLibvips(int x, int y, int z = 0)
Parameters
Type | Name | Description |
---|---|---|
int | x | Major component. |
int | y | Minor component. |
int | z | Patch component. |
Returns
Type | Description |
---|---|
bool | true if at least libvips major.minor[.patch]; otherwise, false. |
CacheSetMax(int)
Set the maximum number of operations libvips will cache.
Declaration
[Obsolete("NetVips.CacheSetMax is deprecated, please use the Cache.Max setter instead.")]
public static void CacheSetMax(int max)
Parameters
Type | Name | Description |
---|---|---|
int | max | Maximum number of operations. |
CacheSetMaxFiles(int)
Limit the operation cache by number of open files.
Declaration
[Obsolete("NetVips.CacheSetMaxFiles is deprecated, please use the Cache.MaxFiles setter instead.")]
public static void CacheSetMaxFiles(int maxFiles)
Parameters
Type | Name | Description |
---|---|---|
int | maxFiles | Maximum open files. |
CacheSetMaxMem(ulong)
Limit the operation cache by memory use.
Declaration
[Obsolete("NetVips.CacheSetMaxMem is deprecated, please use the Cache.MaxMem setter instead.")]
public static void CacheSetMaxMem(ulong maxMem)
Parameters
Type | Name | Description |
---|---|---|
ulong | maxMem | Maximum memory use. |
CacheSetTrace(bool)
Turn on libvips cache tracing.
Declaration
[Obsolete("NetVips.CacheSetTrace is deprecated, please use the Cache.Trace setter instead.")]
public static void CacheSetTrace(bool trace)
Parameters
Type | Name | Description |
---|---|---|
bool | trace | Bool indicating if tracing should be turned on. |
ConcurrencyGet()
Returns the number of worker threads that vips uses for image evaluation.
Declaration
[Obsolete("NetVips.ConcurrencyGet is deprecated, please use the NetVips.Concurrency getter instead.")]
public static int ConcurrencyGet()
Returns
Type | Description |
---|---|
int | The number of worker threads. |
ConcurrencySet(int)
Set the size of the pools of worker threads vips uses for image evaluation.
Declaration
[Obsolete("NetVips.ConcurrencySet is deprecated, please use the NetVips.Concurrency setter instead.")]
public static void ConcurrencySet(int concurrency)
Parameters
Type | Name | Description |
---|---|---|
int | concurrency | The size of the pools of worker threads vips uses for image evaluation. |
Free(IntPtr)
Frees the memory pointed to by mem
.
Declaration
public static void Free(IntPtr mem)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | mem | The memory to free. |
Remarks
This is needed for WriteToMemory(out ulong).
FundamentalType(IntPtr)
Extract the fundamental type ID portion.
Declaration
public static IntPtr FundamentalType(IntPtr type)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | type | A valid type ID. |
Returns
Type | Description |
---|---|
IntPtr | Fundamental type ID. |
GetEnums()
Get a list of enums available within the libvips library.
Declaration
public static List<string> GetEnums()
Returns
Type | Description |
---|---|
List<string> | A list of enums. |
GetOperations()
Get a list of operations available within the libvips library.
Declaration
public static List<string> GetOperations()
Returns
Type | Description |
---|---|
List<string> | A list of operations. |
Remarks
This can be useful for documentation generators.
GetSuffixes()
Get a list of all the filename suffixes supported by libvips.
Declaration
public static string[] GetSuffixes()
Returns
Type | Description |
---|---|
string[] | An array of strings or null. |
Remarks
At least libvips 8.8 is needed.
Init()
Init() starts up the world of VIPS.
Declaration
public static bool Init()
Returns
Type | Description |
---|---|
bool |
Remarks
This function will be automatically called by Initialize() once the assembly is loaded. You should only call this method in your own program if the ModuleInitializer fails to initialize libvips.
LeakSet(bool)
Enable or disable libvips leak checking.
Declaration
[Obsolete("NetVips.LeakSet is deprecated, please use the NetVips.Leak setter instead.")]
public static void LeakSet(bool leak)
Parameters
Type | Name | Description |
---|---|---|
bool | leak | Bool indicating if leak checking should be turned on. |
Remarks
With this enabled, libvips will check for object and area leaks on Shutdown(). Enabling this option will make libvips run slightly more slowly.
MemoryHigh()
Returns the largest number of bytes simultaneously allocated via vips_tracked_malloc(). Handy for estimating max memory requirements for a program.
Declaration
[Obsolete("NetVips.MemoryHigh is deprecated, please use the Stats.MemHighwater getter instead.")]
public static ulong MemoryHigh()
Returns
Type | Description |
---|---|
ulong | The largest number of bytes simultaneously allocated. |
MemoryStats()
Returns an array with:
- the number of active allocations.
- the number of bytes currently allocated via
vips_malloc()
and friends. - the number of open files.
Declaration
[Obsolete("NetVips.MemoryStats is deprecated, please use the Stats class instead.")]
public static int[] MemoryStats()
Returns
Type | Description |
---|---|
int[] | An array with memory stats. Handy for debugging / leak testing. |
NicknameFind(IntPtr)
Return the nickname for a GType.
Declaration
public static string NicknameFind(IntPtr type)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | type | Type to return nickname for. |
Returns
Type | Description |
---|---|
string | Nickname. |
ProfileSet(bool)
Enable or disable libvips profile recording.
Declaration
[Obsolete("NetVips.ProfileSet is deprecated, please use the NetVips.Profile setter instead.")]
public static void ProfileSet(bool profile)
Parameters
Type | Name | Description |
---|---|---|
bool | profile | Bool indicating if profile recording should be turned on. |
Remarks
If set, vips will record profiling information, and dump it on Shutdown().
These profiles can be analyzed with the vipsprofile
program.
Shutdown()
Call this to drop caches, close plugins, terminate background threads, and finalize any internal library testing.
Declaration
public static void Shutdown()
Remarks
Calling this is optional. If you don't call it, your platform will clean up for you. The only negative consequences are that the leak checker (Leak) and the profiler (Profile) will not work.
TypeFind(string, string)
Get the GType for a name.
Declaration
public static IntPtr TypeFind(string basename, string nickname)
Parameters
Type | Name | Description |
---|---|---|
string | basename | Name of base class. |
string | nickname | Search for a class with this nickname. |
Returns
Type | Description |
---|---|
IntPtr | The GType of the class, or Zero if the class is not found. |
Remarks
Looks up the GType for a nickname. Types below basename in the type hierarchy are searched.
TypeFromName(string)
Return the GType for a name.
Declaration
public static IntPtr TypeFromName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | Type name to lookup. |
Returns
Type | Description |
---|---|
IntPtr | Corresponding type ID or Zero. |
TypeName(IntPtr)
Return the name for a GType.
Declaration
public static string TypeName(IntPtr type)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | type | Type to return name for. |
Returns
Type | Description |
---|---|
string | Type name. |
ValuesForEnum(IntPtr)
Get all values for a enum (GType).
Declaration
public static Dictionary<string, int> ValuesForEnum(IntPtr type)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | type | Type to return enum values for. |
Returns
Type | Description |
---|---|
Dictionary<string, int> | A list of values. |
VectorSet(bool)
Enable or disable SIMD.
Declaration
[Obsolete("NetVips.VectorSet is deprecated, please use the NetVips.Vector setter instead.")]
public static void VectorSet(bool enabled)
Parameters
Type | Name | Description |
---|---|---|
bool | enabled | Bool indicating if SIMD should be turned on. |
Version(int, bool)
Get the major, minor or patch version number of the libvips library.
Declaration
public static int Version(int flag, bool fromModule = true)
Parameters
Type | Name | Description |
---|---|---|
int | flag | Pass 0 to get the major version number, 1 to get minor, 2 to get patch. |
bool | fromModule | true to get this value from the pre-initialized Version variable. |
Returns
Type | Description |
---|---|
int | The version number. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If |