### Install libvips Natively Source: https://context7.com/lopcode/vips-ffm/llms.txt Instructions for installing the native libvips library on macOS, Ubuntu/Debian, and Windows. ```bash # macOS: brew install vips ``` ```bash # Ubuntu/Debian: apt install libvips42 ``` ```bash # Windows: add libvips bin directory to PATH ``` -------------------------------- ### Install jemalloc on Ubuntu Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index.html Installs the jemalloc library on Ubuntu systems. This is a prerequisite for using jemalloc as an alternative memory allocator. ```bash apt install libjemalloc2 ``` -------------------------------- ### Generate Thumbnail with vips-ffm Source: https://github.com/lopcode/vips-ffm/blob/main/README.md This Kotlin example demonstrates loading an image, creating a thumbnail, and saving it to disk using the vips-ffm library. It requires the `--enable-native-access=ALL-UNNAMED` JVM argument and JDK 23+. Ensure libvips is installed on your system. ```kotlin import app.photofox.vipsffm.Vips import app.photofox.vipsffm.VImage import app.photofox.vipsffm.VipsOption import app.photofox.vipsffm.enums.VipsAccess // ... // Use `Vips.run` to wrap your usage of the API, and get an arena with an appropriate lifetime to use // Usage of the API, arena, and resulting V-Objects must be done from the thread that called `Vips.run` Vips.run { val thumbnail = VImage.thumbnail( arena, "sample/src/main/resources/sample_images/rabbit.jpg", 400, VipsOption.Boolean("auto-rotate", true) // example of an option ) val thumbnailWidth = thumbnail.width val thumbnailHeight = thumbnail.height logger.info("thumbnail image size: $thumbnailWidth x $thumbnailHeight") val outputPath = workingDirectory.resolve("rabbit_thumbnail.jpg") thumbnail.writeToFile(outputPath.absolutePathString()) } // Optionally call at the end of your program, for memory leak detection, from any thread Vips.shutdown() ``` -------------------------------- ### Install and Preload jemalloc on Ubuntu Source: https://github.com/lopcode/vips-ffm/blob/main/README.md To improve memory allocation performance for long-running, multithreaded processes on glibc-based Linux systems, install jemalloc and set the LD_PRELOAD environment variable. This example shows the steps for Ubuntu. ```sh apt install libjemalloc2 ``` ```sh ln -sT "$(readlink -e /usr/lib/*/libjemalloc.so.2)" /usr/local/lib/libjemalloc.so # symlink jemalloc to a standard location export LD_PRELOAD=/usr/local/lib/libjemalloc.so java -jar ... ``` -------------------------------- ### Get Ref Count Offset Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/_GObject.html Returns the byte offset of the ref_count field from the start of the _GObject structure. This is necessary for direct memory manipulation of the reference count. ```java static long ref_count$offset() ``` -------------------------------- ### init(Arena) Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsHelper.html Initializes the VipsHelper with a given Arena. ```APIDOC ## init(Arena) ### Description Initializes the VipsHelper with a given Arena. ### Method init ### Parameters #### Path Parameters - **Arena** (java.lang.foreign.Arena) - Description not available ``` -------------------------------- ### Vips.init(boolean, boolean) (Deprecated) Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Deprecated method for initializing Vips. Migration to `allowUntrustedOperations()` and `enableLeakDetection()` is recommended. ```APIDOC ## init(boolean, boolean) ### Description This method is deprecated and subject to removal in future versions. Users should migrate to using `Vips.allowUntrustedOperations()` and `Vips.enableLeakDetection()`. Calling `Vips.init()` is no longer required. ### Method Static method ### Parameters - **allowUntrusted** (boolean) - Deprecated parameter. - **enableLeakDetection** (boolean) - Deprecated parameter. ``` -------------------------------- ### init Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsHelper.html Initializes the VIPS library with the provided Arena. ```APIDOC ## init(Arena arena) ### Description Initializes the VIPS library. This method should be called before using other VIPS functions. ### Method `public static void init(Arena arena)` ### Parameters #### Path Parameters - **arena** (Arena) - Required - The memory arena to use for VIPS initialization. ``` -------------------------------- ### g_object_get_property Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/VipsRaw.html Gets the value of a property from a GObject. Supports getting descriptor, handle, or memory address. ```APIDOC ## g_object_get_property ### Description Retrieves the value of a property from a GObject. ### Methods - `g_object_get_property$descriptor()` - `g_object_get_property$handle()` - `g_object_get_property$address()` - `g_object_get_property(MemorySegment, MemorySegment, MemorySegment)` ### Parameters - `g_object_get_property(MemorySegment, MemorySegment, MemorySegment)`: - `object` (MemorySegment) - The GObject instance. - `property_name` (MemorySegment) - The name of the property to get. - `value` (MemorySegment) - A GValue to store the retrieved property value. ``` -------------------------------- ### Get Blurb Method Handle Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/VipsRaw.html Get a MethodHandle for the g_param_spec_get_blurb function. This allows invoking the native function from Java. ```java static MethodHandle g_param_spec_get_blurb$handle() ``` -------------------------------- ### Create VipsSource from Options Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Creates a VipsSource using a string of options. The format of the options string is specific to the Vips library. ```c extern VipsSource *vips_source_new_from_options(const char *options) ``` -------------------------------- ### Get VipsBlob Type Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/VipsRaw.html Provides the C signature for getting the GType of a VIPS blob. This is useful for type checking and introspection. ```c extern GType vips_blob_get_type() ``` -------------------------------- ### Run vips-ffm Samples Source: https://github.com/lopcode/vips-ffm/blob/main/README.md This log output shows the execution of various samples, demonstrating successful validation of different vips-ffm operations. It includes version checks, thumbnail generation, and various image manipulation tasks. ```log [main] INFO vipsffm.SampleRunner - clearing sample run directory at path "sample_run" [main] INFO vipsffm.SampleRunner - running sample "RawGetVersionSample"... [main] INFO vipsffm.sample.RawGetVersionSample - libvips version: "8.15.5" [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "HelperGetVersionSample"... [main] INFO vipsffm.sample.HelperGetVersionSample - libvips version: "8.15.5" [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VImageCreateThumbnailSample"... [main] INFO vipsffm.sample.VImageCreateThumbnailSample - source image size: 2490 x 3084 [main] INFO vipsffm.sample.VImageCreateThumbnailSample - thumbnail image size: 323 x 400 [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VImageChainSample"... [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VSourceTargetSample"... [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VImageCopyWriteSample"... [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VOptionHyphenSample"... [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VImageCachingSample"... [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VImageBlobSample"... [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VImageArrayJoinSample"... [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VBlobByteBufferSample"... [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VTargetToFileSample"... [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VImageJoinSample"... [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VImageFromBytesSample"... [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - running sample "VImageStreamSample"... [main] INFO vipsffm.SampleRunner - validation succeeded ✅ [main] INFO vipsffm.SampleRunner - shutting down vips to check for memory leaks... memory: high-water mark 151.24 MB [main] INFO vipsffm.SampleRunner - all samples ran successfully 🎉 ``` -------------------------------- ### Get GType name address Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/VipsRaw.html Obtain the MemorySegment for the g_type_name function. This is used to get the C string name of a GType. ```java static MemorySegment g_type_name$address() ``` -------------------------------- ### VipsOption.Source Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsOption.html Static factory method to create a Source option with a key. ```APIDOC ## VipsOption.Source(String key) ### Description Creates a Source option with the specified key. ### Method Signature `static VipsOption.Source Source(String key)` ### Parameters #### Path Parameters - **key** (String) - The key for the Source option. ``` -------------------------------- ### Image Fields and Area Manipulation Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsHelper.html Functions to get all fields of an image and to set or get specific areas within an image. ```APIDOC ## image_get_fields ### Description Retrieves all fields associated with the image. ### Method N/A (Function Signature) ### Parameters - **image** (MemorySegment) - The image segment. ## image_set_area ### Description Sets a specific area within the image. ### Method N/A (Function Signature) ### Parameters - **arena** (Arena) - The memory arena. - **image** (MemorySegment) - The image segment. - **area_name** (String) - The name of the area to set. - **data** (MemorySegment) - The data for the area. - **size** (MemorySegment) - The size of the data. ## image_get_area ### Description Retrieves a specific area from the image. ### Method N/A (Function Signature) ### Parameters - **arena** (Arena) - The memory arena. - **image** (MemorySegment) - The image segment. - **area_name** (String) - The name of the area to retrieve. - **output** (MemorySegment) - The memory segment to store the retrieved area data. ``` -------------------------------- ### VipsOption.Blob Constructors and Static Methods Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Constructors and static methods for creating VipsOption.Blob instances. ```APIDOC ## Blob(String, AtomicReference>) ### Description Creates an instance of a `Blob` record class. ### Parameters - **string** (String) - Description not available. - **atomicReference** (AtomicReference>) - Description not available. ## Blob(String) ### Description Static method to create a Blob. ### Parameters - **string** (String) - Description not available. ## Blob(String, VBlob) ### Description Static method to create a Blob. ### Parameters - **string** (String) - Description not available. - **vBlob** (VBlob) - Description not available. ``` -------------------------------- ### GValue Int64 Field Accessors Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/_GValue.data.html Provides methods to get the layout and offset of the `v_int64` field, and to get and set its value. ```APIDOC ## v_int64(MemorySegment union) ### Description Getter for the `v_int64` field. ### Method `static long` ### Endpoint v_int64(MemorySegment union) ``` ```APIDOC ## v_int64(MemorySegment union, long fieldValue) ### Description Setter for the `v_int64` field. ### Method `static void` ### Endpoint v_int64(MemorySegment union, long fieldValue) ``` ```APIDOC ## v_int64$layout() ### Description Layout for the `v_int64` field. ### Method `static final ValueLayout.OfLong` ### Endpoint v_int64$layout() ``` ```APIDOC ## v_int64$offset() ### Description Offset for the `v_int64` field. ### Method `static final long` ### Endpoint v_int64$offset() ``` -------------------------------- ### init Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsHelper.html Initializes the Vips library. This is a binding to the C function vips_init. ```APIDOC ## init ### Description Initializes the Vips library. ### Method public static int init(Arena arena, String argv0String) ### Throws VipsError ``` -------------------------------- ### GValue Int Field Accessors Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/_GValue.data.html Provides methods to get the layout and offset of the `v_int` field, and to get and set its value. ```APIDOC ## v_int(MemorySegment union) ### Description Getter for the `v_int` field. ### Method `static int` ### Endpoint v_int(MemorySegment union) ``` ```APIDOC ## v_int(MemorySegment union, int fieldValue) ### Description Setter for the `v_int` field. ### Method `static void` ### Endpoint v_int(MemorySegment union, int fieldValue) ``` ```APIDOC ## v_int$layout() ### Description Layout for the `v_int` field. ### Method `static final ValueLayout.OfInt` ### Endpoint v_int$layout() ``` ```APIDOC ## v_int$offset() ### Description Offset for the `v_int` field. ### Method `static final long` ### Endpoint v_int$offset() ``` -------------------------------- ### VipsHelper.init(Arena, String) Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Initializes VipsHelper with a memory arena and an argument string. This is a binding for the vips_init function. ```APIDOC ## init(Arena, String) ### Description Initializes the Vips library using the provided memory arena and an argument string, typically the program name. This function is a direct binding to the native `vips_init` function. ### Method Static method ### Parameters - **arena** (Arena) - The memory arena for memory management. - **argv0** (String) - A string representing the program name, used during Vips initialization. ``` -------------------------------- ### GValue Float Field Accessors Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/_GValue.data.html Provides methods to get the layout and offset of the `v_float` field, and to get and set its value. ```APIDOC ## v_float(MemorySegment union) ### Description Getter for the `v_float` field. ### Method `static float` ### Endpoint v_float(MemorySegment union) ``` ```APIDOC ## v_float(MemorySegment union, float fieldValue) ### Description Setter for the `v_float` field. ### Method `static void` ### Endpoint v_float(MemorySegment union, float fieldValue) ``` ```APIDOC ## v_float$layout() ### Description Layout for the `v_float` field. ### Method `static final ValueLayout.OfFloat` ### Endpoint v_float$layout() ``` ```APIDOC ## v_float$offset() ### Description Offset for the `v_float` field. ### Method `static final long` ### Endpoint v_float$offset() ``` -------------------------------- ### Create VipsSource from File Descriptor Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Use this C function to create a VipsSource from a file descriptor (an integer). This is suitable when you have an open file descriptor. ```c extern VipsSource *vips_source_new_from_descriptor(int descriptor) ``` -------------------------------- ### Get GType name from GTypeInstance address Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/VipsRaw.html Obtain the MemorySegment for the g_type_name_from_instance function. This is used to get the C string name of a GTypeInstance. ```java static MemorySegment g_type_name_from_instance$address() ``` -------------------------------- ### Vips Initialization Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/Vips.html Provides methods for initializing and configuring the vips-ffm library. Note that automatic initialization usually occurs when vips-ffm classes are used. ```APIDOC ## Vips() ### Description Default constructor for the Vips class. ### Method ``` public Vips() ``` ``` ```APIDOC ## init() ### Description Initializes the vips-ffm library. This is usually called automatically when vips-ffm classes are used, so manual invocation is typically not required. ### Method ``` public static void init() ``` ``` ```APIDOC ## init(boolean allowUntrusted, boolean detectLeaks) ### Description Deprecated method for initializing the vips-ffm library with options for allowing untrusted operations and enabling leak detection. Migration to `allowUntrustedOperations()` and `enableLeakDetection()` is recommended, as manual `init()` calls are no longer required. ### Method ``` @Deprecated(forRemoval = true) public static void init(boolean allowUntrusted, boolean detectLeaks) ``` ``` -------------------------------- ### Get GType name from GTypeClass address Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/VipsRaw.html Obtain the MemorySegment for the g_type_name_from_class function. This is used to get the C string name of a GTypeClass. ```java static MemorySegment g_type_name_from_class$address() ``` -------------------------------- ### Vips Initialization and Configuration Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/Vips.html Methods for initializing the Vips library, configuring security settings, and enabling leak detection. ```APIDOC ## Vips Initialization and Configuration ### Description Methods for initializing the Vips library, configuring security settings, and enabling leak detection. ### Methods #### `init()` Note that you do not usually need to call `init()` yourself, as initialisation is performed automatically when vips-ffm classes are used. #### `init(boolean allowUntrusted, boolean detectLeaks)` Deprecated, for removal: This API element is subject to removal in a future version. Please migrate to using `allowUntrustedOperations()` and `enableLeakDetection()`, and note that calling `init()` is no longer required. #### `enableLeakDetection()` Enables leak detection. #### `allowUntrustedOperations()` Permits untrusted operations, such as loading PDFs. #### `disableOperationCache()` Disables the libvips operations cache. ``` -------------------------------- ### Get GType class reference handle Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/VipsRaw.html Obtain the downcall method handle for g_type_class_ref. This is used to get a reference to a GType class. ```java static MemorySegment g_type_class_ref$handle() ``` -------------------------------- ### init Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsHelper.html Initializes the Vips library. This is a binding for the C function `vips_init`. ```APIDOC ## init ### Description Initializes the Vips library. This function must be called before using other Vips functions. ### Method Signature `static void init(Arena arena)` ### Parameters - **arena** (Arena) - The memory arena to use for initialization. ``` -------------------------------- ### Get GType class reference address Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/VipsRaw.html Get the memory address for the g_type_class_ref function. This is useful for direct memory access or interop scenarios. ```java static MemorySegment g_type_class_ref$address() ``` -------------------------------- ### VipsSource Methods Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsHelper.html Methods for creating and managing VipsSource instances. ```APIDOC ## source_custom_new ### Description Creates a new custom VipsSource. ### Method `source_custom_new(Arena arena)` ### Parameters * **arena** (Arena) - The memory arena to use. ### Response * **Success Response (0)** - Returns a MemorySegment representing the new custom VipsSource. ## source_get_type ### Description Retrieves the GType of VipsSource. ### Method `source_get_type()` ### Response * **Success Response (0)** - Returns the GType of VipsSource. ## source_new_from_blob ### Description Creates a new VipsSource from a blob. ### Method `source_new_from_blob(Arena arena, MemorySegment blob)` ### Parameters * **arena** (Arena) - The memory arena to use. * **blob** (MemorySegment) - The blob to create the source from. ### Response * **Success Response (0)** - Returns a MemorySegment representing the new VipsSource from the blob. ## source_new_from_descriptor ### Description Creates a new VipsSource from a file descriptor. ### Method `source_new_from_descriptor(Arena arena, int descriptor)` ### Parameters * **arena** (Arena) - The memory arena to use. * **descriptor** (int) - The file descriptor to create the source from. ### Response * **Success Response (0)** - Returns a MemorySegment representing the new VipsSource from the descriptor. ``` -------------------------------- ### area_get_type Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsHelper.html Gets the type of an area. ```APIDOC ## area_get_type() ### Description Gets the type of an area. ### Method area_get_type() ``` -------------------------------- ### Create VipsSource from Memory Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Use this function to create a VipsSource from raw data in memory. Ensure the data pointer and length are valid. ```c extern VipsSource *vips_source_new_from_memory(const void *data, size_t length) ``` -------------------------------- ### Create VipsSource from File Path Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Use this C function to create a VipsSource from a file path (a string). This is the most common method for reading images from disk. ```c extern VipsSource *vips_source_new_from_file(const char *filename) ``` -------------------------------- ### type_depth Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsHelper.html Gets the depth of a type. ```APIDOC ## type_depth(long) ### Description Gets the depth of a type. ### Method type_depth ### Parameters #### Path Parameters - **long** (long) - Description not available ``` -------------------------------- ### Vips.init() Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Initializes the Vips library. Automatic initialization is performed when vips-ffm classes are used, so manual calls are usually not required. ```APIDOC ## init() ### Description Initializes the Vips library. This method is typically called automatically by the vips-ffm library when its classes are first used, so explicit calls are often unnecessary. ### Method Static method ``` -------------------------------- ### complexget Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Get components of complex images. ```APIDOC ## complexget(VipsOperationComplexget, VipsOption...) ### Description Get components of complex images. ### Method Not specified (likely a method of VImage) ### Endpoint Not applicable (SDK method) ### Parameters - **VipsOperationComplexget** (VipsOperationComplexget) - Description not specified - **VipsOption...** (VipsOption...) - Variable number of VipsOption parameters ### Request Example ``` // Example usage would depend on the SDK context ``` ### Response - Description not specified ``` -------------------------------- ### VipsOption.Source Constructor Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsOption.Source.html Constructs a new VipsOption.Source instance. This record class represents a source option with a key and a boxed value. ```APIDOC ## VipsOption.Source Constructor ### Description Creates an instance of a `Source` record class. ### Signature `public static record Source(String key, AtomicReference> box)` ### Parameters * **key** (String) - The key identifying the source option. * **box** (AtomicReference>) - An AtomicReference containing an Optional VSource, representing the boxed value of the source option. ``` -------------------------------- ### VBlob.byteSize() Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the size of the data in this blob. ```APIDOC ## VBlob.byteSize() ### Description Size of the data in this blob ### Method Method ### Endpoint app.photofox.vipsffm/app/photofox/vipsffm/VBlob.html#byteSize() ``` -------------------------------- ### g_type_from_name$handle Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/VipsRaw.html Gets the MethodHandle for g_type_from_name. ```APIDOC ## g_type_from_name$handle ### Description Obtains a MethodHandle for the `g_type_from_name` function, enabling invocation through Java's method handle mechanism. ### Method static java.lang.invoke.MethodHandle g_type_from_name$handle() ### Returns A MethodHandle for the `g_type_from_name` function. ``` -------------------------------- ### VCustomSource / VCustomTarget - Custom Streaming I/O Source: https://context7.com/lopcode/vips-ffm/llms.txt Illustrates how to use VCustomSource and VCustomTarget for fully custom read/seek and write/end callbacks, enabling integration with arbitrary I/O backends. ```APIDOC ## VCustomSource / VCustomTarget - Custom streaming I/O `VCustomSource` and `VCustomTarget` allow fully custom read/seek and write/end callbacks, enabling integration with arbitrary I/O backends (e.g., `FileChannel`, cloud storage SDKs, database BLOBs). ```java import app.photofox.vipsffm.*; import java.nio.channels.FileChannel; import java.nio.file.*; Vips.run(arena -> { // Custom source using FileChannel (supports seeking, needed for TIFF/HEIC) FileChannel channel = FileChannel.open(Path.of("/images/photo.tiff"), StandardOpenOption.READ); VCustomSource.ReadCallback readCb = (buffer, length) -> { int n = channel.read(buffer.asSlice(0, length).asByteBuffer()); return n < 0 ? 0 : n; }; VCustomSource.SeekCallback seekCb = (offset, whence) -> switch (whence) { case SEEK_SET -> channel.position(offset).position(); case SEEK_CUR -> channel.position(channel.position() + offset).position(); case SEEK_END -> channel.position(channel.size() + offset).position(); }; VCustomSource source = new VCustomSource(arena, readCb, seekCb); // Custom target using FileChannel FileChannel outChannel = FileChannel.open(Path.of("/images/out.jpg"), StandardOpenOption.WRITE, StandardOpenOption.CREATE); VCustomTarget.WriteCallback writeCb = buf -> (long) outChannel.write(buf.asByteBuffer()); VCustomTarget.EndCallback endCb = () -> { outChannel.close(); return 0; }; VCustomTarget target = new VCustomTarget(arena, writeCb, endCb); VImage.thumbnailSource(arena, source, 800) .writeToTarget(target, ".jpg"); }); ``` ``` -------------------------------- ### VipsOption.Target Static Methods Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Static methods for creating VipsOption.Target instances. ```APIDOC ## VipsOption.Target Static Methods ### Description Provides static methods for creating `Target` instances within `VipsOption`. ### Methods - **Target(String)**: Creates a target with a given string identifier. - **Target(String, VTarget)**: Creates a target with a given string identifier and a VTarget object. ``` -------------------------------- ### g_type_from_name$descriptor Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/VipsRaw.html Gets the FunctionDescriptor for g_type_from_name. ```APIDOC ## g_type_from_name$descriptor ### Description Provides the FunctionDescriptor for the `g_type_from_name` function, detailing its signature for use with memory access APIs. ### Method static java.lang.foreign.FunctionDescriptor g_type_from_name$descriptor() ### Returns A FunctionDescriptor object representing the `g_type_from_name` function signature. ``` -------------------------------- ### VImage.complexget Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VImage.html Get components of complex images. ```APIDOC ## VImage.complexget ### Description Get components of complex images. ### Method Static method ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **VImage** (VImage) - The extracted component image. #### Response Example None ``` -------------------------------- ### enum_from_nick Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsHelper.html Gets an enum value from its nickname. ```APIDOC ## enum_from_nick(Arena, String, long, String) ### Description Gets an enum value from its nickname. ### Method enum_from_nick ### Parameters #### Path Parameters - **Arena** (java.lang.foreign.Arena) - Description not available - **String** (java.lang.String) - Description not available - **long** (long) - Description not available - **String** (java.lang.String) - Description not available ``` -------------------------------- ### VSource.newFromDescriptor Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Create a new VSource from a file descriptor. ```APIDOC ## VSource.newFromDescriptor ### Description Create a new VSource from a file descriptor. ### Method Static method ### Parameters - **Arena** (Arena) - Description not available - **int** (int) - Description not available ### Endpoint app.photofox.vipsffm.VSource.newFromDescriptor(Arena, int) ``` -------------------------------- ### VipsOption.Source with Value Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsOption.html Static factory method to create a Source option with a key and a VSource value. ```APIDOC ## VipsOption.Source(String key, VSource value) ### Description Creates a Source option with the specified key and VSource value. ### Method Signature `static VipsOption.Source Source(String key, VSource value)` ### Parameters #### Path Parameters - **key** (String) - The key for the Source option. - **value** (VSource) - The VSource value for the option. ``` -------------------------------- ### vips_source_get_type$descriptor Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the function descriptor for vips_source_get_type. ```APIDOC ## vips_source_get_type$descriptor() ### Description Retrieves the function descriptor for `vips_source_get_type`. ### Method static ### Example ```java extern GType vips_source_get_type() ``` ``` -------------------------------- ### vips_source_get_type$address Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the address for the vips_source_get_type function. ```APIDOC ## vips_source_get_type$address() ### Description Provides the memory address for the `vips_source_get_type` function. ### Method static ### Example ```java extern GType vips_source_get_type() ``` ``` -------------------------------- ### Vips.init, Vips.shutdown, and Configuration Source: https://context7.com/lopcode/vips-ffm/llms.txt Manages the lifecycle and global settings of the Vips FFM library. Initialization is automatic, but explicit shutdown is recommended for cleanup and leak detection. ```APIDOC ## Vips Lifecycle and Configuration ### Description Controls the initialization, shutdown, and global behavior of the Vips FFM library. ### Methods - `Vips.allowUntrustedOperations()`: Enables loading of operations from untrusted sources. - `Vips.disableOperationCache()`: Disables the libvips operation cache. - `Vips.enableLeakDetection()`: Enables memory leak detection. - `Vips.shutdown()`: Cleans up resources and reports memory leaks. ### Configuration via System Properties - `vipsffm.autoinit`: Set to `"false"` to disable automatic initialization. - `vipsffm.abinumber.vips.override`: Overrides the native library ABI number. - `vipsffm.libpath.vips.override`: Overrides the native library path. ### Request Example ```java // Disable auto-init System.setProperty("vipsffm.autoinit", "false"); // Allow untrusted operations Vips.allowUntrustedOperations(); // Disable operation cache Vips.disableOperationCache(); // Enable leak detection Vips.enableLeakDetection(); Vips.run(arena -> { // ... image work ... }); // Shutdown and report leaks Vips.shutdown(); ``` ``` -------------------------------- ### VipsOption.Int Constructor Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Creates an instance of an Int VipsOption. ```APIDOC ## VipsOption.Int Constructor ### Description Creates an instance of a `Int` record class. ### Method `Int(String name, AtomicReference> value)` ### Parameters #### Path Parameters - **name** (String) - Required - The name of the integer option. - **value** (AtomicReference>) - Required - The value of the integer option. ``` -------------------------------- ### vips_source_custom_new$descriptor Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the function descriptor for vips_source_custom_new. ```APIDOC ## vips_source_custom_new$descriptor() ### Description Retrieves the function descriptor for `vips_source_custom_new`. ### Method static ### Example ```java extern VipsSourceCustom *vips_source_custom_new() ``` ``` -------------------------------- ### Create VipsTarget to File Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Use this function to create a VipsTarget that writes to a specified file. It requires a filename as input. ```c extern VipsTarget *vips_target_new_to_file(const char *filename) ``` -------------------------------- ### vips_source_custom_new$address Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the address for the vips_source_custom_new function. ```APIDOC ## vips_source_custom_new$address() ### Description Provides the memory address for the `vips_source_custom_new` function. ### Method static ### Example ```java extern VipsSourceCustom *vips_source_custom_new() ``` ``` -------------------------------- ### VipsOption.Blob Constructor Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsOption.Blob.html Constructs a new VipsOption.Blob instance with a key and a boxed value. ```APIDOC ## Blob(String key, AtomicReference> box) ### Description Creates an instance of a `Blob` record class. ### Constructor `Blob(String key, AtomicReference> box)` ### Parameters * **key** (String) - The key identifying the blob option. * **box** (AtomicReference>) - An AtomicReference containing an Optional VBlob value. ``` -------------------------------- ### vips_nickname_find$descriptor() Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the function descriptor for vips_nickname_find. ```APIDOC ## vips_nickname_find$descriptor() ### Description Provides a function descriptor for the `vips_nickname_find` function, useful for dynamic function invocation. ### Usage This descriptor can be used to obtain information about the function's signature and calling conventions. ### Signature ```c extern const char *vips_nickname_find(GType type) ``` ``` -------------------------------- ### vips_nickname_find$address() Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the address for the vips_nickname_find function. ```APIDOC ## vips_nickname_find$address() ### Description Retrieves the memory address for the `vips_nickname_find` function. ### Usage This is typically used for low-level memory operations or interop scenarios. ### Signature ```c extern const char *vips_nickname_find(GType type) ``` ``` -------------------------------- ### VipsOption.String Constructor Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsOption.String.html Constructs a new VipsOption.String instance. This record class represents a string option with a key and a boxed optional string value. ```APIDOC ## Constructor ### Signature `String(String key, AtomicReference> box)` ### Description Creates an instance of a `String` record class. ### Parameters * **key** (String) - The key identifying the string option. * **box** (AtomicReference>) - An AtomicReference holding an Optional String, representing the boxed value of the option. ``` -------------------------------- ### newToFile Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Create a new target pointed at an output file. ```APIDOC ## newToFile(Arena, String) ### Description Create a new target pointed at an output file. ### Method Static method ### Parameters - **Arena** (java.lang.foreign.Arena) - - **String** (java.lang.String) - ### Class app.photofox.vipsffm.VTarget ``` -------------------------------- ### vips_foreign_find_save_target$descriptor Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the function descriptor for vips_foreign_find_save_target. ```APIDOC ## vips_foreign_find_save_target$descriptor ### Description Gets the function descriptor for vips_foreign_find_save_target. ### Method extern ### Endpoint const char *vips_foreign_find_save_target(const char *suffix) ### Parameters #### Path Parameters - **suffix** (const char *) - Description not available ``` -------------------------------- ### Enable Native Access JVM Argument Source: https://context7.com/lopcode/vips-ffm/llms.txt Add this JVM argument to enable native access for Vips FFM. ```bash --enable-native-access=ALL-UNNAMED ``` -------------------------------- ### vips_foreign_find_save_target$address Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the address for the vips_foreign_find_save_target function. ```APIDOC ## vips_foreign_find_save_target$address ### Description Gets the address for the vips_foreign_find_save_target function. ### Method extern ### Endpoint const char *vips_foreign_find_save_target(const char *suffix) ### Parameters #### Path Parameters - **suffix** (const char *) - Description not available ``` -------------------------------- ### vips_foreign_find_save_buffer$descriptor Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the function descriptor for vips_foreign_find_save_buffer. ```APIDOC ## vips_foreign_find_save_buffer$descriptor ### Description Gets the function descriptor for vips_foreign_find_save_buffer. ### Method extern ### Endpoint const char *vips_foreign_find_save_buffer(const char *suffix) ### Parameters #### Path Parameters - **suffix** (const char *) - Description not available ``` -------------------------------- ### newFromSource Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VImage.html Creates a new VImage from a VSource. ```APIDOC ## newFromSource ### Description Creates a new VImage from a VSource. ### Method public static VImage newFromSource(Arena arena, VSource source, VipsOption... options) ### Parameters #### Path Parameters - **arena** (Arena) - Required - The memory arena to use. - **source** (VSource) - Required - The VSource to load the image from. - **options** (VipsOption...) - Optional - An array of VipsOption to apply. ### Throws [VipsError] ``` -------------------------------- ### VipsOption.Image Constructor Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsOption.Image.html Constructs a new VipsOption.Image instance. This record class represents an image option with a key and an associated boxed value. ```APIDOC ## VipsOption.Image(String key, AtomicReference> box) ### Description Creates an instance of a `Image` record class. ### Constructor `Image(String key, AtomicReference> box)` ### Parameters * **key** (String) - The identifier for the image option. * **box** (AtomicReference>) - An AtomicReference holding an Optional VImage, representing the boxed value of the image option. ``` -------------------------------- ### vips_foreign_find_save_buffer$address Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the address for the vips_foreign_find_save_buffer function. ```APIDOC ## vips_foreign_find_save_buffer$address ### Description Gets the address for the vips_foreign_find_save_buffer function. ### Method extern ### Endpoint const char *vips_foreign_find_save_buffer(const char *suffix) ### Parameters #### Path Parameters - **suffix** (const char *) - Description not available ``` -------------------------------- ### VipsOption.String Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VipsOption.html Static factory method to create a String option with a key. ```APIDOC ## VipsOption.String(String key) ### Description Creates a String option with the specified key. ### Method Signature `static VipsOption.String String(String key)` ### Parameters #### Path Parameters - **key** (String) - The key for the String option. ``` -------------------------------- ### vips_blob_copy$descriptor() Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the function descriptor for vips_blob_copy. ```APIDOC ## vips_blob_copy$descriptor() ### Description Gets the function descriptor for vips_blob_copy. ### Method Static method in class app.photofox.vipsffm.jextract.VipsRaw ### Returns MethodHandle - The function descriptor for vips_blob_copy. ``` -------------------------------- ### vips_blob_copy$address() Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Gets the address for the vips_blob_copy function. ```APIDOC ## vips_blob_copy$address() ### Description Gets the address for the vips_blob_copy function. ### Method Static method in class app.photofox.vipsffm.jextract.VipsRaw ### Returns MemorySegment - The address of the vips_blob_copy function. ``` -------------------------------- ### VImage.newFromSource(Arena, VSource, VipsOption...) Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Creates a new VImage from a VSource with specified options. ```APIDOC ## VImage.newFromSource(Arena, VSource, VipsOption...) ### Description Creates a new VImage by reading from a `VSource`. This method allows for image creation from sources that might be more complex than a simple stream or memory segment, using provided options. ### Method Static method in class app.photofox.vipsffm.VImage ### Parameters - **Arena** (java.lang.foreign.Arena) - The arena for memory management. - **VSource** - The source object to read image data from. - **VipsOption...** - Variable number of VipsOption arguments. ``` -------------------------------- ### _GParamSpec.qdata Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Static method to get the offset for a field. ```APIDOC ## qdata$(offset()) ### Description Static method in class app.photofox.vipsffm.jextract._GParamSpec to get the offset for a field. ### Method Static method ### Parameters - **GData** (GData) - The GData structure. ``` -------------------------------- ### VSource.newFromFile Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Create a new VSource from a file path. ```APIDOC ## VSource.newFromFile ### Description Create a new VSource from a file path. ### Method Static method ### Parameters - **Arena** (Arena) - Description not available - **String** (String) - Description not available ### Endpoint app.photofox.vipsffm.VSource.newFromFile(Arena, String) ``` -------------------------------- ### g_param_spec_get_blurb Source: https://github.com/lopcode/vips-ffm/blob/main/docs/index-all.html Static method to get the blurb for a GParamSpec. ```APIDOC ## g_param_spec_get_blurb(MemorySegment) ### Description Static method to get the blurb for a GParamSpec. ### Method extern const gchar *g_param_spec_get_blurb(GParamSpec *pspec) ``` -------------------------------- ### VSource Creation Methods Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VSource.html This section details the static methods available on the VSource class for creating new VSource instances from different data sources. ```APIDOC ## newFromDescriptor(Arena, int) ### Description Creates a new VSource from a file descriptor. ### Method static ### Parameters #### Path Parameters - **arena** (Arena) - Required - The memory arena to use for allocation. - **descriptor** (int) - Required - The file descriptor to create the source from. ### Response #### Success Response (VSource) - Returns a new VSource instance. ## newFromFile(Arena, String) ### Description Creates a new VSource from a file path. ### Method static ### Parameters #### Path Parameters - **arena** (Arena) - Required - The memory arena to use for allocation. - **filename** (String) - Required - The path to the file. ### Response #### Success Response (VSource) - Returns a new VSource instance. ## newFromBlob(Arena, VBlob) ### Description Creates a new VSource from a VBlob, typically received from a Vips operation. ### Method static ### Parameters #### Path Parameters - **arena** (Arena) - Required - The memory arena to use for allocation. - **blob** (VBlob) - Required - The VBlob to create the source from. ### Response #### Success Response (VSource) - Returns a new VSource instance. ## newFromBytes(Arena, byte[]) ### Description Creates a new VSource directly from a byte array. ### Method static ### Parameters #### Path Parameters - **arena** (Arena) - Required - The memory arena to use for allocation. - **bytes** (byte[]) - Required - The byte array to create the source from. ### Response #### Success Response (VSource) - Returns a new VSource instance. ## newFromInputStream(Arena, InputStream) ### Description Creates a new VSource from an InputStream. ### Method static ### Parameters #### Path Parameters - **arena** (Arena) - Required - The memory arena to use for allocation. - **inputStream** (InputStream) - Required - The InputStream to create the source from. ### Response #### Success Response (VSource) - Returns a new VSource instance. ## newFromOptions(Arena, String) ### Description Creates a new VSource from a string representing options. ### Method static ### Parameters #### Path Parameters - **arena** (Arena) - Required - The memory arena to use for allocation. - **options** (String) - Required - The string of options. ### Response #### Success Response (VSource) - Returns a new VSource instance. ``` -------------------------------- ### newFromBytes Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/VImage.html Creates a new VImage from raw bytes with an option string. This method is inefficient and `newFromFile` is recommended. ```APIDOC ## newFromBytes ### Description Creates a new VImage from raw bytes. Note that this is quite inefficient, use `newFromFile` and friends instead. ### Method public static VImage newFromBytes(Arena arena, byte[] bytes, String optionString, VipsOption... options) ### Parameters #### Path Parameters - **arena** (Arena) - Required - The memory arena to use. - **bytes** (byte[]) - Required - The raw image bytes. - **optionString** (String) - Required - A string of options. - **options** (VipsOption...) - Optional - An array of VipsOption to apply. ### Throws [VipsError] ``` -------------------------------- ### vips_image_get_concurrency Source: https://github.com/lopcode/vips-ffm/blob/main/docs/app.photofox.vipsffm/app/photofox/vipsffm/jextract/VipsRaw.html Gets the concurrency setting for a VIPS image. ```APIDOC ## vips_image_get_concurrency ### Description Gets the concurrency setting for a VIPS image. If the image has no specific concurrency setting, the default value is returned. ### C Signature ```c extern int vips_image_get_concurrency(VipsImage *image, int default_concurrency) ``` ### Java Bindings This function is accessible via Java using the Foreign Function & Memory API. The following provides access to its descriptor and method handle. #### Function Descriptor ```java static FunctionDescriptor vips_image_get_concurrency$descriptor() ``` #### Method Handle ```java static MethodHandle vips_image_get_concurrency$handle() ``` ```