Crate vips

Crate vips 

Source
Expand description

vips-rs: Lightweight safety encapsulation of libvips (infrastructure such as initialization, concurrency, caching, versioning, etc.)

Characteristics:

  • Remove ‘lazy_static’ and complete the global initialization with the standard library ‘OnceLock’;
  • Provide ‘init()’/‘is_initialized()’, concurrency/cache control, version information;
  • Unified error handling (grab ‘vips_error_buffer()’);
  • Documentation examples with basic tests.

Usage examples:

use vips::{init, set_concurrency};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // initialization (idempotent), recommended to call as early as possible
    init(Some("my-app"))?;

    // Configure concurrency (default = number of CPU cores)
    vips::set_concurrency(4);

    // Tuning the cache
    vips::set_max_operations(1000);
    vips::set_max_mem_bytes(256 * 1024 * 1024);
    vips::set_max_files(100);

    Ok(())
}

Structs§

VipsImage
Representation of a libvips image. This struct wraps a raw pointer to a VipsImage from the libvips C library. It provides methods for creating, manipulating, and destroying images.
VipsInstance
A singleton instance to manage libvips initialization and shutdown.
VipsInterpolate
VipsInterpolate struct wrapping libvips VipsInterpolate
VipsInterpolateMethod
Function pointer type for VipsInterpolateMethod
VipsRegion
VipsRegion struct wrapping libvips VipsRegion

Enums§

Error
VipsAccess
VipsAlign
VipsAngle
VipsAngle45
VipsArgumentFlags
VipsBandFormat
VipsBlendMode
VipsCoding
VipsCombine
VipsCombineMode
VipsCompassDirection
VipsDemandStyle
VipsDirection
VipsExtend
VipsForeignDzContainer
VipsForeignDzDepth
VipsForeignDzLayout
VipsForeignFlags
VipsForeignPngFilter
VipsForeignTiffCompression
VipsForeignTiffPredictor
VipsForeignTiffResunit
VipsForeignWebpPreset
VipsFormatFlags
VipsImageType
VipsIntent
VipsInteresting
VipsInterpretation
VipsKernel
VipsOperationBoolean
VipsOperationComplex
VipsOperationComplex2
VipsOperationComplexget
VipsOperationFlags
VipsOperationMath
VipsOperationMath2
VipsOperationMorphology
VipsOperationRelational
VipsOperationRound
VipsPCS
VipsPrecision
VipsSize
VipsToken

Traits§

VipsBuffer
Extension trait for thumbnailing from a byte buffer

Functions§

call
code_to_result
Convert the return code (0=OK, non-0=ERR) convention in libvips to Result
concurrency
Get the current concurrency
init
Initialize libvips (idempotent). app_name can be used for logging and diagnostic display. If app_name is None, a default name “vips-rs” will be used.
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
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)
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”

Type Aliases§

Result
A specialized Result type for libvips operations
VipsRect