vips-sys 0.1.3-beta.2

libvips bindings for Rust
Documentation

vips-sys

English | 简体中文

Crates.io Rust Docs docs.rs License Downloads

Low-level Rust FFI bindings for libvips. Designed to be stable, minimal, and a foundation for higher-level wrappers.

Installation

  • macOS
    • brew install vips pkg-config
    • Apple Silicon: ensure PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig
  • Debian/Ubuntu
    • sudo apt-get install -y libvips-dev pkg-config
  • Windows (MSVC)
    • vcpkg install vips and ensure the environment is visible to cargo

Verify pkg-config --cflags --libs vips works (MSVC links via vcpkg).

Features

  • static: prefer static linking
  • dynamic: prefer dynamic linking (default)
  • helpers: minimal helpers for init/shutdown/version

Build-time exports:

  • LIBVIPS_VERSION: detected libvips version string
  • cfg(vips_8_17): enabled when version >= 8.17

Example (helpers)

use vips_sys::helpers;

fn main() {
    helpers::init("vips-sys-example").expect("vips init failed");
    let (a, b, c) = helpers::version();
    println!("libvips version: {}.{}.{}", a, b, c);
    helpers::shutdown();
}

Cargo:

[dependencies]
vips-sys = { version = "0.1.3-beta.2", features = ["helpers"] }

Build notes

This crate uses bindgen:

  • Include paths from pkg-config and pass to clang
  • layout_tests disabled, rustified_enum(".*") enabled
  • Comments disabled to avoid doctest noise
  • Some items blocklisted for portability

Environment:

  • PKG_CONFIG_PATH: path for vips.pc
  • LIBVIPS_NO_BINDGEN: skip bindgen and reuse generated output
  • BINDGEN_EXTRA_CLANG_ARGS: extra -I or flags
  • LIBCLANG_PATH: path to libclang if needed

Troubleshooting

  • Not found vips:
    • Install libvips and pkg-config (or vcpkg on Windows)
    • Check PKG_CONFIG_PATH
  • Bindgen failed:
    • Set LIBCLANG_PATH, or add include dirs via BINDGEN_EXTRA_CLANG_ARGS
  • Static linking on macOS:
    • Prefer dynamic linking due to Homebrew constraints

License

MIT

Changelog

See CHANGELOG.md.