PHPackages                             imagine/imagine - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. imagine/imagine

ActiveLibrary[Image &amp; Media](/categories/media)

imagine/imagine
===============

Image processing for PHP

1.5.2(4mo ago)4.5k72.4M—1.3%529[26 issues](https://github.com/php-imagine/Imagine/issues)[1 PRs](https://github.com/php-imagine/Imagine/pulls)20MITPHPPHP &gt;=7.1CI passing

Since Oct 6Pushed 4mo ago128 watchersCompare

[ Source](https://github.com/php-imagine/Imagine)[ Packagist](https://packagist.org/packages/imagine/imagine)[ Docs](http://imagine.readthedocs.org/)[ RSS](/packages/imagine-imagine/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (42)Used By (20)

Imagine
=======

[](#imagine)

[![PHPUnit](https://github.com/php-imagine/Imagine/actions/workflows/phpunit.yml/badge.svg)](https://github.com/php-imagine/Imagine/actions/workflows/phpunit.yml)[![Coding Style](https://github.com/php-imagine/Imagine/actions/workflows/coding-style.yml/badge.svg)](https://github.com/php-imagine/Imagine/actions/workflows/coding-style.yml)

Tweet about it using the [\#php\_imagine](https://twitter.com/search?q=%23php_imagine) hashtag.

Image manipulation library for PHP inspired by Python's PIL and other image libraries.

Requirements
------------

[](#requirements)

The Imagine library has the following requirements:

- PHP 7.1+

Older version of the library support also older PHP Version:

- PHP 5.5 - 7.0 use version ^1.3
- PHP 5.3 - 5.4 use version ^1.2

Depending on the chosen Image implementation, you may need one of the following PHP extensions:

- GD2
- Imagick (with ImageMagick version 6.2.9 or later, except version 7.0.7-32)
- Gmagick

To read EXIF metadata (e.g. for autorotation), activate the PHP `exif` extension. This is optional: Imagine works without the PHP `exif` extension, but then it can't read and act on image orientation or other EXIF metadata.

### Installation using composer

[](#installation-using-composer)

`php composer.phar require imagine/imagine`

Basic Principles
----------------

[](#basic-principles)

The main purpose of Imagine is to provide all the necessary functionality to bring all native low level image processing libraries in PHP to the same simple and intuitive OO API.

Several things are necessary to accomplish that:

- Image manipulation tools, such as resize, crop, etc.
- Drawing API - to create basic shapes and advanced charts, write text on the image
- Masking functionality - ability to apply black&amp;white or grayscale images as masks, leading to semi-transparency or absolute transparency of the image the mask is being applied to

The above tools should be the basic foundation for a more powerful set of tools that are called `Filters` in Imagine.

Some of the ideas for upcoming filters:

- Charting and graphing filters - pie and bar charts, linear graphs with annotations
- Reflection - apple style
- Rounded corners - web 2.0

Documentation
-------------

[](#documentation)

- [Hosted by Read The Docs](http://imagine.readthedocs.org/)

Presentations
-------------

[](#presentations)

- [Introduction to Imagine](http://www.slideshare.net/avalanche123/introduction-toimagine)
- [How to Take Over the World with Lithium](http://speakerdeck.com/u/nateabele/p/how-to-take-over-the-world-with-lithium?slide=33)

Articles
--------

[](#articles)

- [Image Processing with Imagine](http://www.phparch.com/2011/03/image-processing-with-imagine)

Contributing
------------

[](#contributing)

### Branches

[](#branches)

New pull requests should be based on the `develop` branch. The `master` branch is the stable branch: it usually matches the latest a release but in can be a bit ahead.

### Test groups

[](#test-groups)

Some PHPUnit test is marked as skipped (for example, tests that require a driver that support multiple layers and executed with the GD driver). In addition, if you don't have installed gmagick, the gmagick tests will be marked as skipped.

If you don't want to run tests that are marked as "always skipped" you can tell PHPUnit to exclude the `always-skipped` group. The same for the tests that require a specific driver (`gd`, `imagick`, `imagick`).

So, for example, to exclude the `always-skipped` and the `gmagick` tests, you can launch phpunit with this command options:

```
composer run test -- --exclude-group always-skipped,gmagick

```

### Development environment

[](#development-environment)

Setting up an environment with all the required libraries may be very hard. In order to run the tests locally, you can use the same [docker images](https://github.com/php-imagine/docker-builder/pkgs/container/test) used by Imagine to test the pull requests.

For example, if you have Imagine locally in the `/home/me/imagine` folder, you can run tests for PHP 8.1 with the GD and Imagick with this very simple approach:

1. Launch a temporary docker container with: ```
    docker run --rm -it -v /home/me/imagine:/app -w /app ghcr.io/php-imagine/test:8.1-gd-imagick bash
    ```
2. Inside the docker container, run these commands: ```
    # Start a local web server: some tests require it
    cd tests
    php -n -S 0.0.0.0:8013 >/dev/null 2>&1 &
    cd ..
    # Tell the tests that the local web server is available at the port 8013
    export IMAGINE_TEST_WEBSERVERURL=http://localhost:8013
    # Install the composer dependencies
    composer update
    # Run the tests
    composer run test -- --exclude-group always-skipped,gmagick
    ```

> Note: This approach works on Windows too: simply launch the docker container with
>
> ```
> docker run --rm -it -v C:\Path\To\Imagine:/app -w /app ghcr.io/php-imagine/test:8.1-gd-imagick bash
>
> ```

### Built test files

[](#built-test-files)

Many tests create temporary files (in the `tests/tmp` directory) containing built images. Those temporary files are compared with expected images, and then are deleted. If you want to keep those temporary files (for example, to check what's being built), you can set the `IMAGINE_TEST_KEEP_TEMPFILES` environment variable. If the `IMAGINE_TEST_KEEP_TEMPFILES` is configured in the GitHub Action tests, those temporary files are attached to tests as an articact.

###  Health Score

73

—

ExcellentBetter than 100% of packages

Maintenance76

Regular maintenance activity

Popularity81

Widely adopted with strong download metrics

Community61

Healthy contributor diversity

Maturity70

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~133 days

Recently: every ~236 days

Total

40

Last Release

130d ago

Major Versions

v0.7.1 → 1.0.0-alpha12018-08-28

PHP version history (4 changes)0.2.0PHP &gt;=5.3.0

0.2.5PHP &gt;=5.3.2

1.3.0PHP &gt;=5.5

1.5.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e9d7ece045fc89575e083ee4852edf31218df403c84f41a0de01863dae982f5?d=identicon)[mlocati](/maintainers/mlocati)

![](https://avatars.githubusercontent.com/u/83289?v=4)[Bulat Shakirzyanov](/maintainers/avalanche123)[@avalanche123](https://github.com/avalanche123)

![](https://www.gravatar.com/avatar/3c264f69af4c60cb9cc98a522b4663f4b6a2708629cabc14409478ab6fc35348?d=identicon)[romain](/maintainers/romain)

---

Top Contributors

[![mlocati](https://avatars.githubusercontent.com/u/928116?v=4)](https://github.com/mlocati "mlocati (584 commits)")[![avalanche123](https://avatars.githubusercontent.com/u/83289?v=4)](https://github.com/avalanche123 "avalanche123 (481 commits)")[![romainneutron](https://avatars.githubusercontent.com/u/137574?v=4)](https://github.com/romainneutron "romainneutron (357 commits)")[![vlakoff](https://avatars.githubusercontent.com/u/544424?v=4)](https://github.com/vlakoff "vlakoff (31 commits)")[![ausi](https://avatars.githubusercontent.com/u/367169?v=4)](https://github.com/ausi "ausi (31 commits)")[![rjkip](https://avatars.githubusercontent.com/u/1734555?v=4)](https://github.com/rjkip "rjkip (21 commits)")[![mitsuhiko](https://avatars.githubusercontent.com/u/7396?v=4)](https://github.com/mitsuhiko "mitsuhiko (18 commits)")[![rejinka](https://avatars.githubusercontent.com/u/831348?v=4)](https://github.com/rejinka "rejinka (18 commits)")[![armatronic](https://avatars.githubusercontent.com/u/407053?v=4)](https://github.com/armatronic "armatronic (14 commits)")[![nicodmf](https://avatars.githubusercontent.com/u/173332?v=4)](https://github.com/nicodmf "nicodmf (12 commits)")[![christeredvartsen](https://avatars.githubusercontent.com/u/25402?v=4)](https://github.com/christeredvartsen "christeredvartsen (12 commits)")[![burzum](https://avatars.githubusercontent.com/u/162789?v=4)](https://github.com/burzum "burzum (11 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (11 commits)")[![anthonysterling](https://avatars.githubusercontent.com/u/159960?v=4)](https://github.com/anthonysterling "anthonysterling (9 commits)")[![jmikola](https://avatars.githubusercontent.com/u/244663?v=4)](https://github.com/jmikola "jmikola (7 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (6 commits)")[![RadekDvorak](https://avatars.githubusercontent.com/u/672781?v=4)](https://github.com/RadekDvorak "RadekDvorak (5 commits)")[![chregu](https://avatars.githubusercontent.com/u/47106?v=4)](https://github.com/chregu "chregu (4 commits)")[![alexander-schranz](https://avatars.githubusercontent.com/u/1698337?v=4)](https://github.com/alexander-schranz "alexander-schranz (4 commits)")[![nokrosis](https://avatars.githubusercontent.com/u/130460?v=4)](https://github.com/nokrosis "nokrosis (4 commits)")

---

Tags

image manipulationimage processingdrawinggraphics

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/imagine-imagine/health.svg)

```
[![Health](https://phpackages.com/badges/imagine-imagine/health.svg)](https://phpackages.com/packages/imagine-imagine)
```

###  Alternatives

[rokka/imagine-vips

libvips adapter for imagine

43564.1k5](/packages/rokka-imagine-vips)[pixelandtonic/imagine

Image processing for PHP

133.4M3](/packages/pixelandtonic-imagine)[batdan/midjourney-api-php

Generate images Midjourney (Discord API). URLs in prompt accepted

222.2k](/packages/batdan-midjourney-api-php)[orchestra/imagine

Imagine (Wrapper) Component for Laravel

70207.0k3](/packages/orchestra-imagine)[ace-of-aces/laravel-image-transform-url

Easy, URL-based image transformations inspired by Cloudflare Images.

1756.4k](/packages/ace-of-aces-laravel-image-transform-url)[andrewgjohnson/imagettftextblur

imagettftextblur is a drop in replacement for imagettftext with added parameters to add blur, glow and shadow effects to your PHP GD images

27198.4k1](/packages/andrewgjohnson-imagettftextblur)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
