There’s a new libvips binding for Python. It has the same API as the one that comes with libvips (it passes the same test suite), it’s very easy to install on Linux, macOS and Windows, it works with any Python, it should be smaller and more stable, and it has nice new documentation:

The README in the repository for the binding has more details, including some install notes and an example:

But briefly, just get the libvips shared library on your system and enter:

pip install pyvips

Why a new binding?

The Python binding included in libvips works, but porting and installation are more difficult than they should be.

This new binding is:

How it works

This binding is based on cffi, the FFI package for Python. It opens the libvips shared library and uses the libvips introspection system to make the operations it finds appear as members of the pyvips.Image class.

This dynamic approach via ffi has several nice properties:

What’s next?

The Python binding that comes with libvips will be kept for a while, but from libvips 8.6 onwards, we plan to point people towards pyvips instead.