https://github.com/intervention/image-driver-vips
libvips driver for Intervention Image
https://github.com/intervention/image-driver-vips
image libvips php vips
Last synced: 2 months ago
JSON representation
libvips driver for Intervention Image
- Host: GitHub
- URL: https://github.com/intervention/image-driver-vips
- Owner: Intervention
- License: mit
- Created: 2024-07-11T14:22:41.000Z (almost 2 years ago)
- Default Branch: develop
- Last Pushed: 2026-03-31T07:12:52.000Z (2 months ago)
- Last Synced: 2026-03-31T09:20:30.063Z (2 months ago)
- Topics: image, libvips, php, vips
- Language: PHP
- Homepage: https://image.intervention.io
- Size: 2.72 MB
- Stars: 44
- Watchers: 2
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# libvips driver for Intervention Image
[](https://packagist.org/packages/intervention/image-driver-vips)
[](https://github.com/Intervention/image-driver-vips/actions)
[](https://packagist.org/packages/intervention/image-driver-vips/stats)
[](https://ko-fi.com/interventionphp)
Intervention Image's official driver to use [Intervention Image](https://github.com/Intervention/image) with
[libvips](https://github.com/libvips/libvips). libvips is a fast, low-memory
image processing library that outperforms the standard PHP image extensions GD
and Imagick. This package makes it easy to utilize the power of libvips in your
project while taking advantage of Intervention Image's user-friendly and
easy-to-use API.
## Installation
Install this library using [Composer](https://getcomposer.org). Simply request the package with the following command:
```bash
composer require intervention/image-driver-vips
```
## Getting Started
The public [API](https://image.intervention.io) of Intervention Image can be
used unchanged. The only [configuration](https://image.intervention.io/v4/basics/configuration-drivers) that needs to be done is to ensure that
`Intervention\Image\Drivers\Vips\Driver` by this library is used by `Intervention\Image\ImageManager`.
## Code Examples
```php
use Intervention\Image\Image;
use Intervention\Image\Drivers\Vips\Driver as VipsDriver;
use Intervention\Image\Alignment;
use Intervention\Image\Format;
// create image manager instance using the desired driver
$manager = ImageManager::usingDriver(VipsDriver::class);
// read image data from path
$image = $manager->decodePath('images/example.webp');
// scale image by height
$image->scale(height: 300);
// insert a watermark
$image->insert('images/watermark.png', alignment: Alignment::BOTTOM_RIGHT);
// encode edited image
$encoded = $image->encodeUsingFormat(format: Format::JPEG, quality: 65);
// save encoded image
$encoded->save('images/example.jpg');
```
## Requirements
- PHP >= 8.3
## Caveats
- Due to the technical characteristics of libvips, it is currently **not possible**
to implement color quantization via `ImageInterface::reduceColors()` as
intended. However, there is a [pull request in
libvips](https://github.com/libvips/php-vips/issues/256#issuecomment-2575872401)
that enables this feature and it may be integrated here the future as well.
- With PHP on macOS, font files are not recognized in the
`ImageInterface::text()` call by default because Quartz as a rendering engine
does not allow font files to be loaded at runtime via the fontconfig API.
However, setting the environment variable `PANGOCAIRO_BACKEND` to
`fontconfig` helps here.
## Authors
This library was developed by [Oliver Vogel](https://intervention.io) and Thomas Picquet.
## License
Intervention Image Driver Vips is licensed under the [MIT License](LICENSE).