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. |
Free(nint)
Frees the memory pointed to by mem.
Declaration
public static void Free(nint mem)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | mem | The memory to free. |
Remarks
This is needed for WriteToMemory(out ulong).
FundamentalType(nint)
Extract the fundamental type ID portion.
Declaration
public static nint FundamentalType(nint type)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | type | A valid type ID. |
Returns
| Type | Description |
|---|---|
| nint | 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.
NicknameFind(nint)
Return the nickname for a GType.
Declaration
public static string NicknameFind(nint type)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | type | Type to return nickname for. |
Returns
| Type | Description |
|---|---|
| string | Nickname. |
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 nint 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 |
|---|---|
| nint | 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 nint TypeFromName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Type name to lookup. |
Returns
| Type | Description |
|---|---|
| nint | Corresponding type ID or Zero. |
TypeName(nint)
Return the name for a GType.
Declaration
public static string TypeName(nint type)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | type | Type to return name for. |
Returns
| Type | Description |
|---|---|
| string | Type name. |
ValuesForEnum(nint)
Get all values for a enum (GType).
Declaration
public static Dictionary<string, int> ValuesForEnum(nint type)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | type | Type to return enum values for. |
Returns
| Type | Description |
|---|---|
| Dictionary<string, int> | A list of values. |
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 |