https://github.com/houseme/vips-sys
Low-level Rust FFI bindings for libvips. Provides the foundation for higher-level, safer wrappers.
https://github.com/houseme/vips-sys
imagemagick libvips rust rust-ffi rust-ffi-bindings rust-ffi-wrappers rust-library vips vips-image vips-sys
Last synced: 3 months ago
JSON representation
Low-level Rust FFI bindings for libvips. Provides the foundation for higher-level, safer wrappers.
- Host: GitHub
- URL: https://github.com/houseme/vips-sys
- Owner: houseme
- License: mit
- Created: 2018-04-18T19:17:35.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2025-12-01T19:50:06.000Z (6 months ago)
- Last Synced: 2026-03-05T17:07:30.389Z (3 months ago)
- Topics: imagemagick, libvips, rust, rust-ffi, rust-ffi-bindings, rust-ffi-wrappers, rust-library, vips, vips-image, vips-sys
- Language: Rust
- Homepage: https://houseme.github.io/vips-sys/
- Size: 12.1 MB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# vips-sys
[English](README.md) \| [简体中文](README_CN.md)
[](https://crates.io/crates/vips-sys)
[](https://github.com/houseme/vips-sys/actions/workflows/rust.yml)
[](https://houseme.github.io/vips-sys/vips-sys/)
[](https://docs.rs/vips-sys/)
[](./LICENSE)
[](https://crates.io/crates/vips-sys)
Low-level Rust FFI bindings for `libvips`. Designed to be stable, minimal, and a foundation for higher-level wrappers.
- Docs: https://houseme.github.io/vips-sys/vips_sys/
- Requirement: `libvips >= 8.2` (validated on `8.17.2`)
- Goals: reliable builds, cross-platform reuse, in-sync with upstream
## 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`)
```rust
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:
```toml
[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](LICENSE)
## Changelog
See [`CHANGELOG.md`](CHANGELOG.md).