libvips/libvips
A fast image processing library with low memory needs.
libvips: An Image Processing Library
What It Is
libvips is a library for processing images — resizing, cropping, filtering, converting formats, and many other operations. Its key design trait is that it's demand-driven and horizontally threaded: it only does the work you actually ask for, and it splits that work across multiple CPU threads. The README claims this makes it fast and memory-efficient compared to similar libraries.
It's open source, licensed under LGPL-2.1-or-later.
What It Can Do
- ~300 operations covering arithmetic, histograms, convolution, morphological operations, frequency filtering, colour, resampling, statistics, and more.
- Wide numeric range: from 8-bit integers up to 128-bit complex numbers.
- Any number of bands per image (e.g., grayscale, RGB, RGBA, or more).
- Many image formats: JPEG, JPEG 2000, JPEG XL, TIFF, PNG, WebP, HEIC, AVIF, FITS, Matlab, OpenEXR, PDF, SVG, HDR, PPM/PGM/PFM, CSV, GIF, Analyze, NIfTI, DeepZoom, and OpenSlide. It can also load images via ImageMagick or GraphicsMagick, which extends support to formats like DICOM.
Language Bindings
It ships with built-in bindings for C, C++, and a command-line interface. Full community bindings exist for:
- Ruby (ruby-vips)
- Python (pyvips)
- PHP (php-vips)
- C# / .NET (NetVips)
- Go (vips-gen)
- Lua (lua-vips)
- Crystal (crystal-vips)
- Elixir (vix)
- Java (vips-ffm)
- Nim (libvips-nim)
- Rust (vips-rs)
Who Uses It
Notable projects that use libvips as their image processing engine:
- Mastodon (social network)
- sharp (Node.js image library)
- imgproxy
- wsrv.nl
- bimg
- Ruby on Rails (Active Storage)
- CarrierWave
- MediaWiki
The official GUI for libvips is nip4, described as "a strange combination of a spreadsheet and a photo editor."
Installation
- Unix-like systems (including macOS): packages are available via most package managers.
- Windows: prebuilt binaries are provided in the project's GitHub releases.
- Detailed install notes are on the libvips website.
Building from Source
Requirements:
- Meson build system (version 0.56 or later)
- A backend for Meson: ninja, Visual Studio, or XCode
- Core dependencies:
build-essential,pkg-config,libglib2.0-dev,libexpat1-dev
Basic build steps:
cd libvips-x.y.z
meson setup build --prefix /my/install/prefix
cd build
meson compile
meson test
meson install
You can toggle features and dependencies with flags like -Dnsgif=false or -Dmagick=disabled (see meson_options.txt). After installation, a more comprehensive test suite can be run with pytest.
Optional Dependencies
libvips automatically enables support for libraries it finds on your system. Key ones include:
- libjpeg (or mozjpeg / libjpeg-turbo) — JPEG
- libultrahdr — UltraHDR images
- libexif — EXIF metadata in JPEGs
- librsvg — SVG loading (falls back to ImageMagick)
- libraw — camera RAW loading (falls back to ImageMagick)
- PDFium or poppler-glib — PDF loading (falls back to ImageMagick)
- cgif — GIF saving (falls back to ImageMagick)
- libarchive — image pyramids via
dzsave - libtiff — TIFF
- fftw3 — Fourier transforms
- lcms2 — ICC profile manipulation
- libpng — PNG (falls back to spng)
- libimagequant or quantizr — 8-bit palette-ised PNG/GIF writing
- ImageMagick or GraphicsMagick — broad format support (the README warns about security implications of enabling this for untrusted images)
- pangocairo — text rendering
- highway — SIMD acceleration (falls back to orc-0.4)
- matio — Matlab files
- cfitsio — FITS images
- libwebp — WebP
- libniftiio — NIfTI images
- OpenEXR — reading OpenEXR (not writing)
- OpenJPEG — JPEG 2000
- libjxl — JPEG XL
- OpenSlide — virtual slide formats (Aperio, Hamamatsu, Leica, MIRAX, Sakura, Trestle, Ventana)
- libheif — HEIC and AVIF (requires libheif built with appropriate codecs)
Summary
libvips is a mature, widely adopted image processing library that prioritizes speed and low memory usage through demand-driven, threaded execution. It supports a vast range of formats and operations, has bindings for most major languages, and is used in production by well-known projects. It's easy to install via package managers, and building from source is straightforward with Meson.
Related
- Project
- Project
- Project
- Project