image
PHP Image Processing
PHP library for resizing, watermarking, and converting images in web applications, switch between GD, Imagick, or libvips with one line of config.
Intervention Image is a PHP library for reading, editing, and saving images on a web server. PHP is one of the most common programming languages for building websites, and this library gives PHP applications a straightforward way to handle image processing tasks without writing complex low-level code.
The library can resize images, insert watermarks, change formats, and adjust quality. A developer writing PHP code for a website that lets users upload photos, for example, could use Intervention Image to automatically resize those photos, compress them to a smaller file size, or convert them from one format to another, all in a few lines of code.
One practical feature is that the library does not depend on a single underlying image processing engine. PHP environments can have different tools installed for handling images: GD is a basic library that comes built into PHP by default, Imagick is a more capable extension based on ImageMagick, and libvips is a high-performance option for large or complex workloads. Intervention Image supports all three and lets you switch between them by changing one line of configuration. This means the same code can run on servers with different setups without modification. The library also supports animated images across all three drivers.
Installation is done through Composer, which is the standard PHP package manager. The library requires PHP version 8.3 or newer and one of the three supported image processing extensions. It works with any PHP framework or without one. It is released under the MIT license and is free to use in both personal and commercial projects.
Where it fits
- Automatically resize and compress user-uploaded photos in a PHP web app.
- Convert images between formats such as PNG to WebP in a few lines of PHP code.
- Add watermarks to images before serving them from your website.
- Handle animated image processing on any PHP server regardless of which image extension is installed.