libvips/README.md

281 lines
9.9 KiB
Markdown
Raw Normal View History

2012-06-29 13:20:50 +02:00
# libvips : an image processing library
2007-08-29 18:23:50 +02:00
[![CI](https://github.com/libvips/libvips/workflows/CI/badge.svg)](https://github.com/libvips/libvips/actions)
[![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
# 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).
It has around [300
2021-01-22 13:45:08 +01:00
operations](https://libvips.github.io/libvips/API/current/func-list.html)
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.
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),
and the
2021-01-22 13:45:08 +01:00
[command-line](https://libvips.github.io/libvips/API/current/using-cli.html).
Full bindings are available for [Ruby](https://rubygems.org/gems/ruby-vips),
2018-08-17 18:52:45 +02:00
[Python](https://pypi.python.org/pypi/pyvips),
2018-09-21 18:05:47 +02:00
[PHP](https://github.com/libvips/php-vips),
2019-02-10 06:31:33 +01:00
[C# / .NET](https://www.nuget.org/packages/NetVips),
2018-08-17 18:52:45 +02:00
[Go](https://github.com/davidbyttow/govips), and
2018-09-21 18:05:47 +02:00
[Lua](https://github.com/libvips/lua-vips). libvips
is used as an image processing engine by [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
2021-01-22 13:45:08 +01:00
Rails](https://edgeguides.rubyonrails.org/active_storage_overview.html),
2018-08-17 18:52:45 +02:00
[carrierwave-vips](https://github.com/eltiare/carrierwave-vips),
2021-01-22 13:45:08 +01:00
[mediawiki](https://www.mediawiki.org/wiki/Extension:VipsScaler),
2018-08-17 18:52:45 +02:00
[PhotoFlow](https://github.com/aferrero2707/PhotoFlow) and others.
2018-09-21 18:05:47 +02:00
The official libvips GUI is [nip2](https://github.com/libvips/nip2),
2021-04-18 18:57:09 +02:00
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
libvips uses the [Meson build system](https://mesonbuild.com), version 0.56 or
2022-02-08 19:28:35 +01:00
later, with [ninja](https://ninja-build.org).
2022-02-08 17:04:51 +01:00
To compile, 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.
## Cheatsheet
```
cd libvips-x.y.x
meson setup build --prefix=/aaa/bbb/ccc
cd build
ninja
ninja install
```
Notes:
- Check the output of `meson setup` carefully and make sure it found
everything you wanted it to find.
2022-02-08 19:28:35 +01:00
- Add flags like `-Dnsgif=false` to turn options on and off, see
`meson_options.txt` for a list of all the build options libvips supports.
- Add `--buildtype=release` for a release (optimised) build.
- You might need to add `--libdir=lib` on Debian if you don't want the arch
name in the library path.
2022-02-08 17:04:51 +01:00
- Use `--default-library=static` for a static build.
- Use `ninja test` to run the tests.
- There's a more comprehensive test suite you can run with `pytest`.
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`,
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
If PDFium is not detected, libvips will look for poppler-glib instead.
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
2015-07-10 13:44:02 +02:00
### libgsf-1
2015-07-10 13:44:02 +02:00
If available, libvips adds support for creating image pyramids with `dzsave`.
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()`
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
If present, libvips will load PNG files using libspng. At the moment, libpng
is still necessary for save.
2015-07-10 13:44:02 +02:00
### libpng
2012-06-29 13:20:50 +02:00
2020-12-27 17:26:38 +01:00
If libspng is not present and libpng is, libvips will load PNG files with
libpng. It will always save PNG files with libpng.
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
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
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
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
### Code Contributors
2019-12-07 17:59:33 +01:00
This project exists thanks to all the people who contribute.
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-12-07 17:59:33 +01:00
### Organizations
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.
<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>