Sign inSign up

lamka02sk/picturium-libvips

By lamka02sk

•Updated 14 days ago

Image
Languages & frameworks
Developer tools
0

1.2K

lamka02sk/picturium-libvips repository overview


Safe(r) Rust wrappers over raw bindgen⁠-generated libvips FFI. It covers the operations picturium actually needs — loading, resizing, cropping, filters, color, animation, text, and multi-format saving — not the whole libvips surface.

This is not a general-purpose libvips crate. Coverage is driven by picturium's requirements, API shape may change without notice, and anything not listed below just isn't wrapped yet.

Current libvips version: 8.18.6

⁠Features

  • Loading — from file, buffer/memory, raw pixel matrix, SVG, and PDF, with per-loader options
  • Core operations — resize, embed, rotate/autorotate, ICC transform, flatten, premultiply/unpremultiply, background fill, replicate, band-join, array-join
  • Cropping & gravity — area extraction, attention/entropy-based smart crop, compass-direction placement onto a canvas
  • Thumbnails — direct-to-thumbnail generation from file or in-memory image, with crop/size/profile options
  • Filters — linear transforms, matrix recombination, Gaussian blur, sharpen
  • Color — colorspace conversion, interpretation re-tagging, LUT mapping
  • Animation — page height, per-frame delays, loop count, and orientation for animated GIF/WebP/AVIF
  • Text — render text to an alpha mask for compositing/watermarking
  • Saving — JPEG, PNG, WebP, HEIF, JXL, and GIF, both to file and to an in-memory buffer
  • Runtime control — cache limits, concurrency, memory/leak stats via the libvips runtime

⁠Requirements

  • libvips 8.18.6 (headers + shared library) available to the linker
  • GLib/GObject development headers
  • src/bindings.rs is checked into the repo, so a normal build links against libvips without needing bindgen/libclang; delete it and run cargo build to regenerate against a different libvips install

The picturium Docker images⁠ already ship a matching libvips build — see docker/build.yml⁠ for the base image this crate builds against.

⁠Usage

use picturium_libvips::*;

fn main() -> Result<()> {
    let vips = Vips::new("app")?;
    vips.cache(Cache::disabled()).concurrency(4);

    let image = VipsImage::new_from_file("input.jpg", None)?
        .autorotate()?
        .thumbnail_image(800, None)?;

    image.save_webp("output.webp", None)?;

    Ok(())
}

⁠Development

cargo test

Tests exercise the bindings against a real libvips install, so they need the same runtime requirements as above. docker/build.yml builds an image with the full toolchain (Rust, clang, GLib headers) for regenerating bindings or running tests in a clean environment.

⁠License

MIT⁠

⁠AI disclosure

Most of the core library code is human-written with minor AI assistance. Documentation and testing handled primarily by AI.

Tag summary

Content type

Image

Digest

sha256:4dc32c45c…

Size

855.5 MB

Last updated

14 days ago

docker pull lamka02sk/picturium-libvips