A libvips implementation of the Mako pixel image processing library.
The package provides a high-performance libvips backend for common image transformation and processing tasks, while integrating with Pixel's shared API for images, colors, geometry, operations, and inspectors.
This package is built on top of jcupitt/vips, which uses FFI to communicate with libvips.
libvips is not bundled with this package and must be installed separately.
Note that the libvips package name varies between operating systems and distributions. The following are examples and may differ depending on your system and the version of libvips available.
sudo apt-get install --no-install-recommends libvips42brew install vipsSee the libvips installation documentation for further instructions.
composer require mako/pixel-vipsThe Vips implementation works just like the GD and ImageMagick implementations and shares the exact same API.
use mako\pixel\image\Color;
use mako\pixel\image\operations\Pipeline;
use mako\pixel\image\operations\vips\Border;
use mako\pixel\image\operations\vips\Sharpen;
use mako\pixel\image\Vips;
$image = new Vips('image.png');
$image->apply(new Pipeline(
new Sharpen,
new Border(new Color(0, 0, 0, 127), width: 10),
));
$image->save();Images are loaded using random access by default, which supports all operations and inspectors. If you're only doing single-pass processing (load, transform, save) then you can switch to sequential access for better performance and lower memory usage.
Vips::setAccessMode(AccessMode::Sequential);Note that operations and inspectors that read pixels out of order (e.g. pixel inspection or rotation by arbitrary angles) will fail when using sequential access.