Expand description
vips-rs: Lightweight safety encapsulation of libvips (initialization, concurrency, caching, versioning, and image IO).
§Safety model
- Raw libvips pointers are private to each wrapper. Use safe methods, or
as_ptr()when bridging to lower-level FFI (the pointer is valid only while the wrapper lives; do not unref it). - All
unsafeblocks are concentrated in this crate withSAFETY:notes. - Global
initis process-locked; RAII types unref onDrop.
use vips::{init, set_concurrency};
fn main() -> Result<(), Box<dyn std::error::Error>> {
init(Some("my-app"))?;
vips::set_concurrency(4);
vips::set_max_operations(1000);
vips::set_max_mem_bytes(256 * 1024 * 1024);
vips::set_max_files(100);
Ok(())
}Structs§
- Vips
Image - Safe RAII wrapper around a libvips
VipsImage*. - Vips
Instance - A singleton compatibility handle for process-wide libvips initialization. Dropping it leaves libvips available to live images and other threads.
- Vips
Interpolate - Safe RAII wrapper around a libvips
VipsInterpolate*. - Vips
Interpolate Method - Function-pointer wrapper for a
VipsInterpolateimplementation. - Vips
Owned Buffer - An immutable libvips allocation. Reading it does not copy the pixel or
encoded data into the Rust allocator. Drop releases it with
g_free. - Vips
Region - Safe RAII wrapper around a libvips
VipsRegion*.
Enums§
- Error
- Vips
Access - Vips
Align - Vips
Angle - Vips
Angle45 - Vips
Argument Flags - Vips
Band Format - Vips
Blend Mode - Vips
Coding - Vips
Combine - Vips
Combine Mode - Vips
Compass Direction - Vips
Demand Style - Vips
Direction - Vips
Extend - Vips
Foreign DzContainer - Vips
Foreign DzDepth - Vips
Foreign DzLayout - Vips
Foreign Flags - Vips
Foreign Keep - Vips
Foreign PdfPage Box - Vips
Foreign PngFilter - Vips
Foreign Tiff Compression - Vips
Foreign Tiff Predictor - Vips
Foreign Tiff Resunit - Vips
Foreign Webp Preset - Vips
Format Flags - Vips
Image Type - Vips
Intent - Vips
Interesting - Vips
Interpretation - Vips
Kernel - Vips
Operation Boolean - Vips
Operation Complex - Vips
Operation Complex2 - Vips
Operation Complexget - Vips
Operation Flags - Vips
Operation Math - Vips
Operation Math2 - Vips
Operation Morphology - Vips
Operation Relational - Vips
Operation Round - VipsPCS
- Vips
Precision - Vips
Size - Vips
Token
Traits§
- Vips
Buffer - Extension trait for thumbnailing encoded image bytes.
Functions§
- black
- Create a one-band 8-bit black image (
vips_black). - code_
to_ result - Convert the return code (0=OK, non-0=ERR) convention in libvips to Result
- concurrency
- Get the current concurrency
- find_
load - Loader nickname libvips would use for
path(e.g."VipsForeignLoadJpegFile"). - find_
save - Saver nickname libvips would use for
path(e.g."VipsForeignSaveJpegFile"). - gaussnoise
- Create Gaussian noise (
vips_gaussnoise). - grey
- Create a grey ramp image (
vips_grey). - init
- Initialize libvips (idempotent, thread-safe).
app_nameis used for logging and diagnostics; defaults to"vips-rs"whenNone. - interpretation_
bands - Number of colour bands used by an interpretation (libvips 8.18+).
- is_
initialized - Is it currently initialized?
- max_
files - Get the maximum number of files configured
- max_
mem_ bytes - Get the maximum cache memory (bytes) configured
- max_
operations - Gets the maximum number of compute nodes configured
- perlin
- Create a Perlin noise image (
vips_perlin). - set_
concurrency - Set concurrency (<=0 will fall back to default)
- set_
max_ files - Set the maximum number of files allowed to open at the same time
- set_
max_ mem_ bytes - Set the maximum memory allowed in bytes for the cache
- set_
max_ operations - Sets the maximum number of compute nodes that can be retained in the cache
- set_
trace - Print the diagnostic information for each cache hit/build (1 on, 0 off)
- sines
- Create a sine-wave test image (
vips_sines). - size_
operations - Gets the number of compute nodes in the current cache
- take_
vips_ error - Read and empty the error buffer of libvips
- tracked_
mem_ bytes - Currently tracked memory (bytes)
- tracked_
mem_ highwater_ bytes - Historical Peak Memory Usage (bytes)
- version
- Returns the libvips version as a tuple: (major, minor, micro)
- version_
string - Returns the full version string, such as “8.14.2”
- vips_
call ⚠ - xyz
- Create a two-band coordinate image (
vips_xyz). - zone
- Create a zone-plate test image (
vips_zone).