Skip to content

Intervention Image

A PHP library for creating and editing images, using GD, Imagick or libvips underneath.Intervention/image

Stars
14.4k
Forks
1.5k
Licence
MIT
Language
PHP
Last update
7 days ago
Type
Library

What it is

Intervention Image is a PHP library that lets code resize, edit, combine and save images through one consistent set of commands. Instead of learning the separate APIs of PHP's image extensions, you pick a driver (GD, Imagick or libvips) and use the same fluent methods. It is framework-agnostic, so it can be added to any PHP project with Composer.

  • Scale an uploaded photo down to a fixed height
  • Add a watermark image to a corner of a picture
  • Read a WebP file and re-encode it as JPEG at a chosen quality
  • Process animated images with the supported drivers

Great for

  • PHP developers who need to resize or convert uploaded images on a server
  • Projects that may need to switch between GD, Imagick or libvips depending on the server
  • Developers building watermarking or image-generation features in PHP
  • Teams that want a documented, MIT-licensed image library

Not ideal for

  • Non-PHP projects, since the library only runs in PHP (requires PHP 8.3 or newer)
  • People who need a finished image editor application rather than code to build with
  • Servers where none of GD, Imagick or libvips can be installed
Step-by-step guide: how to use Intervention ImageInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: PHP 8.3 or newer · Mbstring PHP extension · GD, Imagick or libvips PHP extension · Composer

    Install the package with Composer

    composer require intervention/image
  2. 2

    Run it

    • Install the package with Composer.
    • Create an ImageManager using a driver such as GdDriver.
    • Read an image with decodePath().
    • Apply an edit such as scale(height: 300).
    • Encode and save the result with save().
  3. 3

    Get the most out of it

    • Switch drivers (GD, Imagick or libvips) to suit your server, using the same code
    • Use encodeUsingFormat() with a quality setting to control file size
    • Use insert() with an Alignment constant to place watermarks
    • Read the official documentation at image.intervention.io for the full list of methods

Downloads

Strengths

  • Single API works across GD, Imagick and libvips drivers
  • Framework-agnostic and installable via Composer
  • Released under the permissive MIT license

Trade-offs

  • Requires PHP 8.3 or newer plus an image extension, which may not suit older hosting
  • Usage is code-based, so there is no graphical interface
  • The README excerpt does not list every supported operation; check the official docs for details

How it compares

ProjectStarsTypeLevelUpdatedBest for
image (this)14.4kLibraryintermediate7 days agoPHP developers who need to resize or convert uploaded images on a server
symfony31.2kLibraryintermediate4 days agoPHP developers building web applications that need a structured framework
Mobile-Detect10.7kLibrarybeginner15 days agoPHP developers who need to tell mobile and tablet visitors apart on the server
framework35kFrameworkintermediate4 days agoPHP developers building web applications or APIs
bagisto28.3kAppintermediate4 days agoDevelopers building a custom online store on Laravel
PhotoSwipe25.3kLibraryintermediate11 months agoWeb developers who want a photo gallery or lightbox on a site

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.