2012-06-29 13:20:50 +02:00
|
|
|
# libvips : an image processing library
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2021-02-08 21:10:37 +01:00
|
|
|
[![CI](https://github.com/libvips/libvips/workflows/CI/badge.svg)](https://github.com/libvips/libvips/actions)
|
2019-09-19 07:05:42 +02:00
|
|
|
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/libvips.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=2&q=proj:libvips)
|
2019-12-07 17:59:33 +01:00
|
|
|
[![Coverity Status](https://scan.coverity.com/projects/6503/badge.svg)](https://scan.coverity.com/projects/jcupitt-libvips)
|
2021-01-06 11:15:04 +01:00
|
|
|
[![Gitter](https://badges.gitter.im/libvips/devchat.svg)](https://gitter.im/libvips/devchat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
2015-09-30 12:37:42 +02:00
|
|
|
|
2020-05-01 17:05:48 +02:00
|
|
|
# Introduction
|
|
|
|
|
2018-08-17 18:52:45 +02:00
|
|
|
libvips is a [demand-driven, horizontally
|
2018-09-21 18:05:47 +02:00
|
|
|
threaded](https://github.com/libvips/libvips/wiki/Why-is-libvips-quick)
|
2018-08-17 18:52:45 +02:00
|
|
|
image processing library. Compared to similar
|
|
|
|
libraries, [libvips runs quickly and uses little
|
2018-09-21 18:05:47 +02:00
|
|
|
memory](https://github.com/libvips/libvips/wiki/Speed-and-memory-use).
|
2018-08-17 18:52:45 +02:00
|
|
|
libvips is licensed under the [LGPL
|
|
|
|
2.1+](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html).
|
|
|
|
|
2018-09-25 11:43:37 +02:00
|
|
|
It has around [300
|
2021-01-22 13:45:08 +01:00
|
|
|
operations](https://libvips.github.io/libvips/API/current/func-list.html)
|
2018-09-25 11:43:37 +02:00
|
|
|
covering arithmetic, histograms, convolution, morphological
|
|
|
|
operations, frequency filtering, colour, resampling,
|
|
|
|
statistics and others. It supports a large range of [numeric
|
2021-01-22 13:45:08 +01:00
|
|
|
types](https://libvips.github.io/libvips/API/current/VipsImage.html#VipsBandFormat),
|
2018-08-17 18:52:45 +02:00
|
|
|
from 8-bit int to 128-bit complex. Images can have any number of bands.
|
2021-04-18 18:57:09 +02:00
|
|
|
It supports a good range of image formats, including JPEG, JPEG2000, 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, letting it work with formats
|
|
|
|
like DICOM.
|
2018-09-25 11:43:37 +02:00
|
|
|
|
|
|
|
It comes with bindings for
|
2021-01-22 13:45:08 +01:00
|
|
|
[C](https://libvips.github.io/libvips/API/current/using-from-c.html),
|
|
|
|
[C++](https://libvips.github.io/libvips/API/current/using-from-cpp.html),
|
2018-09-25 11:43:37 +02:00
|
|
|
and the
|
2021-01-22 13:45:08 +01:00
|
|
|
[command-line](https://libvips.github.io/libvips/API/current/using-cli.html).
|
2022-06-30 15:41:44 +02:00
|
|
|
Full bindings are available for :
|
|
|
|
|
|
|
|
| Language | Binding |
|
|
|
|
|---|---|
|
|
|
|
| Ruby | [ruby-vips](https://rubygems.org/gems/ruby-vips) |
|
|
|
|
| Python | [pyvips](https://pypi.python.org/pypi/pyvips) |
|
|
|
|
| PHP | [php-vips](https://github.com/libvips/php-vips) |
|
|
|
|
| C# / .NET | [NetVips](https://www.nuget.org/packages/NetVips) |
|
|
|
|
| Go | [govips](https://github.com/davidbyttow/govips) |
|
|
|
|
| Lua | [lua-vips](https://github.com/libvips/lua-vips) |
|
|
|
|
| Crystal | [crystal-vips](https://github.com/naqvis/crystal-vips) |
|
|
|
|
|
|
|
|
libvips is used as an image processing engine by:
|
|
|
|
|
2022-06-30 15:01:06 +02:00
|
|
|
| |
|
|
|
|
|---|
|
2022-06-30 15:41:44 +02:00
|
|
|
| [sharp (on node.js)](https://www.npmjs.org/package/sharp) |
|
|
|
|
| [bimg](https://github.com/h2non/bimg) |
|
|
|
|
| [sharp for Go](https://github.com/DAddYE/vips) |
|
|
|
|
| [Ruby on Rails](https://edgeguides.rubyonrails.org/active_storage_overview.html) |
|
|
|
|
| [carrierwave-vips](https://github.com/eltiare/carrierwave-vips) |
|
|
|
|
| [mediawiki](https://www.mediawiki.org/wiki/Extension:VipsScaler) |
|
|
|
|
| [PhotoFlow](https://github.com/aferrero2707/PhotoFlow) |
|
|
|
|
|
|
|
|
and others. The official libvips GUI is
|
|
|
|
[nip2](https://github.com/libvips/nip2), a strange combination of a
|
|
|
|
spreadsheet and a photo editor.
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2019-06-15 14:21:43 +02:00
|
|
|
# Install
|
2008-03-26 17:56:51 +01:00
|
|
|
|
2019-07-18 09:43:41 +02:00
|
|
|
There are packages for most Unix-like operating systems, including
|
|
|
|
macOS. Check your package manager.
|
2019-06-15 14:21:43 +02:00
|
|
|
|
|
|
|
There are binaries for Windows in
|
|
|
|
[releases](https://github.com/libvips/libvips/releases).
|
|
|
|
|
|
|
|
The [libvips website](https://libvips.github.io/libvips) has [detailed
|
|
|
|
install notes](https://libvips.github.io/libvips/install.html).
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2022-02-08 17:04:51 +01:00
|
|
|
# Building from source
|
|
|
|
|
2022-02-09 09:57:58 +01:00
|
|
|
libvips uses the [Meson build system](https://mesonbuild.com), version 0.56
|
2022-02-10 09:42:17 +01:00
|
|
|
or later. Meson can use [`ninja`](https://ninja-build.org), Visual Studio or
|
|
|
|
XCode as a backend, so you'll also need one of them.
|
2022-02-08 17:04:51 +01:00
|
|
|
|
2022-02-09 09:57:58 +01:00
|
|
|
libvips must have `build-essential`, `pkg-config`, `libglib2.0-dev`,
|
|
|
|
`libexpat1-dev`. See the **Dependencies** section below for a full list
|
|
|
|
of the libvips optional dependencies.
|
2022-02-08 17:04:51 +01:00
|
|
|
|
|
|
|
## Cheatsheet
|
|
|
|
|
|
|
|
```
|
|
|
|
cd libvips-x.y.x
|
2022-02-09 09:57:58 +01:00
|
|
|
meson setup build-dir --prefix=/aaa/bbb/ccc
|
|
|
|
cd build-dir
|
2022-02-19 16:13:42 +01:00
|
|
|
meson compile
|
2022-02-09 09:57:58 +01:00
|
|
|
meson test
|
|
|
|
meson install
|
2022-02-08 17:04:51 +01:00
|
|
|
```
|
|
|
|
|
2022-02-09 09:57:58 +01:00
|
|
|
Check the output of `meson setup` carefully and make sure it found everything
|
|
|
|
you wanted it to find. Add arguments to `meson setup` to change the build
|
|
|
|
configuration.
|
2022-02-08 17:04:51 +01:00
|
|
|
|
2022-02-22 11:06:43 +01:00
|
|
|
- Add flags like `-Dnsgif=false` to turn libvips options on and off, see
|
2022-02-08 19:28:35 +01:00
|
|
|
`meson_options.txt` for a list of all the build options libvips supports.
|
2022-02-18 10:45:54 +01:00
|
|
|
|
2022-02-22 11:06:43 +01:00
|
|
|
- Add flags like `-Dmagick=disable` to turn libvips dependencies on and off,
|
|
|
|
see `meson_options.txt` and the list below for a summary of all the libvips
|
|
|
|
dependencies.
|
|
|
|
|
2022-02-09 10:31:13 +01:00
|
|
|
- Meson will do a debug build by default. Add `--buildtype=release` for a
|
|
|
|
release (optimised) build.
|
2022-02-18 10:45:54 +01:00
|
|
|
|
2022-02-08 19:28:35 +01:00
|
|
|
- You might need to add `--libdir=lib` on Debian if you don't want the arch
|
|
|
|
name in the library path.
|
2022-02-18 10:45:54 +01:00
|
|
|
|
2022-02-09 09:57:58 +01:00
|
|
|
- Add `--default-library=static` for a static build.
|
2022-02-18 10:45:54 +01:00
|
|
|
|
2022-02-09 09:57:58 +01:00
|
|
|
- Use eg. `CC=clang CXX=clang++ meson setup ...` to change compiler.
|
2022-02-18 10:45:54 +01:00
|
|
|
|
2022-02-09 09:57:58 +01:00
|
|
|
- You can have many `build-dir`, pick whatever names you like, for example
|
|
|
|
one for release and one for debug.
|
|
|
|
|
|
|
|
There's a more comprehensive test suite you can run once libvips has been
|
|
|
|
installed. Use `pytest` in the libvips base directory.
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2019-12-07 18:02:26 +01:00
|
|
|
## Optional dependencies
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2012-06-29 13:20:50 +02:00
|
|
|
If suitable versions are found, libvips will add support for the following
|
2022-02-08 17:04:51 +01:00
|
|
|
libraries automatically. Packages are generally found with `pkg-config`,
|
2022-02-09 09:57:58 +01:00
|
|
|
so make sure that is working.
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
### libjpeg
|
2012-06-29 13:20:50 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
The IJG JPEG library. Use the `-turbo` version if you can.
|
2012-06-29 13:20:50 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
### libexif
|
2012-06-29 13:20:50 +02:00
|
|
|
|
2012-06-29 13:36:56 +02:00
|
|
|
If available, libvips adds support for EXIF metadata in JPEG files.
|
2012-06-29 13:20:50 +02:00
|
|
|
|
2016-03-08 10:00:57 +01:00
|
|
|
### librsvg
|
|
|
|
|
|
|
|
The usual SVG loader. If this is not present, vips will try to load SVGs
|
|
|
|
via imagemagick instead.
|
|
|
|
|
2018-04-07 18:36:52 +02:00
|
|
|
### PDFium
|
|
|
|
|
2020-12-24 06:44:07 +01:00
|
|
|
If present, libvips will attempt to load PDFs with PDFium. Download the
|
|
|
|
prebuilt pdfium binary from:
|
|
|
|
|
|
|
|
https://github.com/bblanchon/pdfium-binaries
|
|
|
|
|
|
|
|
Untar to the libvips install prefix, for example:
|
|
|
|
|
|
|
|
cd ~/vips
|
|
|
|
tar xf ~/pdfium-linux.tgz
|
|
|
|
|
|
|
|
Create a `pdfium.pc` like this (update the version number):
|
|
|
|
|
|
|
|
VIPSHOME=/home/john/vips
|
|
|
|
cat > $VIPSHOME/lib/pkgconfig/pdfium.pc << EOF
|
|
|
|
prefix=$VIPSHOME
|
|
|
|
exec_prefix=\${prefix}
|
|
|
|
libdir=\${exec_prefix}/lib
|
|
|
|
includedir=\${prefix}/include
|
|
|
|
Name: pdfium
|
|
|
|
Description: pdfium
|
|
|
|
Version: 4290
|
|
|
|
Requires:
|
|
|
|
Libs: -L\${libdir} -lpdfium
|
|
|
|
Cflags: -I\${includedir}
|
|
|
|
EOF
|
2018-04-07 18:36:52 +02:00
|
|
|
|
2022-02-18 10:45:54 +01:00
|
|
|
If PDFium is not detected, libvips will look for `poppler-glib` instead.
|
2018-04-07 18:36:52 +02:00
|
|
|
|
2019-04-27 12:41:26 +02:00
|
|
|
### poppler-glib
|
2016-03-08 10:00:57 +01:00
|
|
|
|
2019-04-27 12:41:26 +02:00
|
|
|
The Poppler PDF renderer, with a glib API. If this is not present, vips
|
|
|
|
will try to load PDFs via imagemagick.
|
2016-03-08 10:00:57 +01:00
|
|
|
|
2022-02-18 10:45:54 +01:00
|
|
|
### cgif
|
|
|
|
|
|
|
|
If available, libvips will save GIFs with
|
|
|
|
[cgif](https://github.com/dloebl/cgif). If this is not present, vips will
|
|
|
|
try to save gifs via imagemagick instead.
|
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
### libgsf-1
|
2014-05-09 14:13:18 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
If available, libvips adds support for creating image pyramids with `dzsave`.
|
2014-05-09 14:13:18 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
### libtiff
|
2012-06-29 13:20:50 +02:00
|
|
|
|
|
|
|
The TIFF library. It needs to be built with support for JPEG and
|
|
|
|
ZIP compression. 3.4b037 and later are known to be OK.
|
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
### fftw3
|
2012-06-29 13:20:50 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
If libvips finds this library, it uses it for fourier transforms.
|
2012-06-29 13:20:50 +02:00
|
|
|
|
2019-04-27 12:41:26 +02:00
|
|
|
### lcms2
|
2012-06-29 13:20:50 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
If present, `vips_icc_import()`, `vips_icc_export()` and `vips_icc_transform()`
|
2021-01-16 19:56:14 +01:00
|
|
|
can be used to manipulate images with ICC profiles.
|
2012-06-29 13:20:50 +02:00
|
|
|
|
2020-12-27 17:26:38 +01:00
|
|
|
### libspng
|
|
|
|
|
2022-02-18 10:45:54 +01:00
|
|
|
If present, libvips will load and save PNG files using libspng. If not, it
|
|
|
|
will look for the standard libpng package.
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2021-11-21 12:39:52 +01:00
|
|
|
### libimagequant, quantizr
|
2018-08-07 16:07:38 +02:00
|
|
|
|
2021-11-21 12:39:52 +01:00
|
|
|
If one of these quantisation packages is present, libvips can write 8-bit
|
|
|
|
palette-ised PNGs and GIFs.
|
2018-08-07 16:07:38 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
### ImageMagick, or optionally GraphicsMagick
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2022-02-08 17:04:51 +01:00
|
|
|
If available, libvips adds support for loading and saving all
|
|
|
|
libMagick-supported image file types. You can enable and disable load and save
|
|
|
|
separately.
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2016-05-05 10:14:58 +02:00
|
|
|
Imagemagick 6.9+ needs to have been built with `--with-modules`. Most packaged
|
2018-06-11 13:23:18 +02:00
|
|
|
IMs are, I think.
|
2016-05-05 10:14:58 +02:00
|
|
|
|
2016-05-09 15:06:44 +02:00
|
|
|
If you are going to be using libvips with untrusted images, perhaps in a
|
2019-04-27 12:41:26 +02:00
|
|
|
web server, for example, you should consider the security implications of
|
|
|
|
enabling a package with such a large attack surface.
|
2016-05-09 15:06:44 +02:00
|
|
|
|
2021-04-12 17:52:14 +02:00
|
|
|
### pangocairo
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2012-06-29 13:36:56 +02:00
|
|
|
If available, libvips adds support for text rendering. You need the
|
2021-04-12 17:52:14 +02:00
|
|
|
package pangocairo in `pkg-config --list-all`.
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
### orc-0.4
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2012-06-29 13:36:56 +02:00
|
|
|
If available, vips will accelerate some operations with this run-time
|
|
|
|
compiler.
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
### matio
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2012-06-29 13:36:56 +02:00
|
|
|
If available, vips can load images from Matlab save files.
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
### cfitsio
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2012-06-29 13:36:56 +02:00
|
|
|
If available, vips can load FITS images.
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
### libwebp
|
2015-01-26 15:58:49 +01:00
|
|
|
|
|
|
|
If available, vips can load and save WebP images.
|
|
|
|
|
2018-08-07 16:07:38 +02:00
|
|
|
### libniftiio
|
|
|
|
|
2020-02-11 16:20:12 +01:00
|
|
|
If available, vips can load and save NIfTI images.
|
2018-08-07 16:07:38 +02:00
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
### OpenEXR
|
2011-01-06 15:18:00 +01:00
|
|
|
|
2012-06-29 13:36:56 +02:00
|
|
|
If available, libvips will directly read (but not write, sadly)
|
|
|
|
OpenEXR images.
|
2011-01-06 15:18:00 +01:00
|
|
|
|
2021-04-03 19:50:18 +02:00
|
|
|
### OpenJPEG
|
|
|
|
|
|
|
|
If available, libvips will read and write JPEG2000 images.
|
|
|
|
|
2021-04-18 18:57:09 +02:00
|
|
|
### libjxl
|
|
|
|
|
|
|
|
If available, libvips will read and write JPEG-XL images.
|
|
|
|
|
2015-07-10 13:44:02 +02:00
|
|
|
### OpenSlide
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2012-06-29 13:36:56 +02:00
|
|
|
If available, libvips can load OpenSlide-supported virtual slide
|
2014-01-25 08:31:20 +01:00
|
|
|
files: Aperio, Hamamatsu, Leica, MIRAX, Sakura, Trestle, and Ventana.
|
2007-08-29 18:23:50 +02:00
|
|
|
|
2019-04-27 12:41:26 +02:00
|
|
|
### libheif
|
|
|
|
|
2021-01-16 19:56:14 +01:00
|
|
|
If available, libvips can load and save HEIC and AVIF images. Your libheif (in
|
|
|
|
turn) needs to be built with the correct decoders and encoders. You can check
|
|
|
|
with eg.:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ pkg-config libheif --print-variables
|
|
|
|
builtin_avif_decoder
|
|
|
|
builtin_avif_encoder
|
|
|
|
builtin_h265_decoder
|
|
|
|
builtin_h265_encoder
|
|
|
|
exec_prefix
|
|
|
|
includedir
|
|
|
|
libdir
|
|
|
|
pcfiledir
|
|
|
|
prefix
|
|
|
|
```
|
2019-04-27 12:41:26 +02:00
|
|
|
|
2019-12-07 17:59:33 +01:00
|
|
|
# Contributors
|
2019-10-18 02:40:58 +02:00
|
|
|
|
|
|
|
### Code Contributors
|
|
|
|
|
2019-12-07 17:59:33 +01:00
|
|
|
This project exists thanks to all the people who contribute.
|
2019-10-18 02:40:58 +02:00
|
|
|
|
2019-12-07 17:59:33 +01:00
|
|
|
<a href="https://github.com/libvips/libvips/graphs/contributors"><img src="https://opencollective.com/libvips/contributors.svg?width=890&button=false" /></a>
|
2019-10-18 02:40:58 +02:00
|
|
|
|
2019-12-07 17:59:33 +01:00
|
|
|
### Organizations
|
2019-10-18 02:40:58 +02:00
|
|
|
|
2019-12-07 18:02:26 +01:00
|
|
|
Support this project with your organization. Your logo will show up here with a link to your website.
|
2019-10-18 02:40:58 +02:00
|
|
|
|
|
|
|
<a href="https://opencollective.com/libvips/organization/0/website"><img src="https://opencollective.com/libvips/organization/0/avatar.svg"></a>
|
|
|
|
<a href="https://opencollective.com/libvips/organization/1/website"><img src="https://opencollective.com/libvips/organization/1/avatar.svg"></a>
|
|
|
|
<a href="https://opencollective.com/libvips/organization/2/website"><img src="https://opencollective.com/libvips/organization/2/avatar.svg"></a>
|
|
|
|
<a href="https://opencollective.com/libvips/organization/3/website"><img src="https://opencollective.com/libvips/organization/3/avatar.svg"></a>
|
|
|
|
<a href="https://opencollective.com/libvips/organization/4/website"><img src="https://opencollective.com/libvips/organization/4/avatar.svg"></a>
|
|
|
|
<a href="https://opencollective.com/libvips/organization/5/website"><img src="https://opencollective.com/libvips/organization/5/avatar.svg"></a>
|
|
|
|
<a href="https://opencollective.com/libvips/organization/6/website"><img src="https://opencollective.com/libvips/organization/6/avatar.svg"></a>
|
|
|
|
<a href="https://opencollective.com/libvips/organization/7/website"><img src="https://opencollective.com/libvips/organization/7/avatar.svg"></a>
|
|
|
|
<a href="https://opencollective.com/libvips/organization/8/website"><img src="https://opencollective.com/libvips/organization/8/avatar.svg"></a>
|
|
|
|
<a href="https://opencollective.com/libvips/organization/9/website"><img src="https://opencollective.com/libvips/organization/9/avatar.svg"></a>
|