PHPackages                             aiger-team/image-tools - 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. aiger-team/image-tools

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

aiger-team/image-tools
======================

Light image editing tool with immutable objects style

v1.0.7(9y ago)1217[1 issues](https://github.com/AigerTeam/ImageTools/issues)MITPHPPHP &gt;=5.3

Since Nov 17Pushed 4y ago1 watchersCompare

[ Source](https://github.com/AigerTeam/ImageTools)[ Packagist](https://packagist.org/packages/aiger-team/image-tools)[ Docs](https://github.com/AigerTeam/ImageTools)[ RSS](/packages/aiger-team-image-tools/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (7)DependenciesVersions (9)Used By (0)

Image Tools
===========

[](#image-tools)

A simple image editing tool for PHP. It uses the immutable object style. It means that an image object can't be changed after creation, the result of any modifying method of an image object is a new image object.

Installation
------------

[](#installation)

### Composer

[](#composer)

Add this to the `composer.json` file:

```
"require": {
  "aiger-team/image-tools": "~1.0.7"
}
```

and then call:

```
composer install
```

Or use the composer require command:

```
composer require aiger-team/image-tools
```

### Manually

[](#manually)

Download the files [from GitHub](https://github.com/AigerTeam/ImageTools/archive/master.zip), put them to your code directory and require them into your PHP code.

Examples
--------

[](#examples)

Resize an image:

```
use AigerTeam\ImageTools\ImageFactory;

(new ImageFactory())
	->openFile('image.jpg')
	->resize(600, 500)
	->toFile('image-resized.jpg');
```

Create a few thumbnails from an uploaded image and put a watermark on some of them:

```
use AigerTeam\ImageTools\ImageFactory;

// List of thumb to create. The values are width, height and "put watermark?".
$thumbsSizes = [
	[150, 80, false],
	[300, 200, true],
	[500, 400, true]
];

// Open uploaded image and watermark image
$factory   = new ImageFactory();
$image     = $factory->openFile($_FILES['image']['tmp_name']);
$watermark = $factory->openFile('watermark.png');

// Make thumbs
$thumbsFiles = array_map(function($size) use ($image, $watermark)
{
	$thumb = $image->resize($size[0], $size[1], false, $image::SIZING_COVER);	// Original $image is not modified so thumbs may be created in any order

	if ($size[2]) {
		$thumb = $thumb->stamp($watermark, 0.2);	// Watermark size is relative, not pixel
	}

	return $thumb->toUncertainFile('uploads/thumbs');	// File name and format is set automatically
}, $thumbSizes);
```

Reference
---------

[](#reference)

None of methods triggers errors or warnings. Instead of that methods throw exceptions. If some of them triggers an error please [report us](https://github.com/AigerTeam/ImageTools/issues/new).

### Creating Image object

[](#creating-image-object)

An `Image` object can be created by various ways.

#### 1. Using one of the ImageFactory object method

[](#1-using-one-of-the-imagefactory-object-method)

```
use AigerTeam\ImageTools\ImageFactory;

$factory = new ImageFactory();
$image = $factory->blank(100, 150);
```

See the PHPDoc in the `ImageFactory` [class code](https://github.com/AigerTeam/ImageTools/blob/master/src/ImageFactory.php)for more details and the list of all image creating methods.

#### 2. Passing a DG image resource to the Image constructor

[](#2-passing-a-dg-image-resource-to-the-image-constructor)

```
use AigerTeam\ImageTools\Image;

$resource = imagecreatetruecolor(100, 150);
$image = new Image($resource);
```

The resource passed to the constructor becomes an `Image` object own. So the resource can be modified inside the constructor and the resource will be automatically destroyed on the `Image` object destruction.

### Processing an image

[](#processing-an-image)

`Image` object is immutable. The `Image` methods that modify image return a new object or the original object (if it's not modified). So this code is **incorrect**:

```
// WRONG! Don't do this or you will be fired.
$image->resize(200, 150);
$image->toFile('image.jpg');
```

This one is **correct**:

```
// Variant 1
$image = $image->resize(200, 150);
$image->toFile('image.jpg');

// Variant 2
$image
	->resize(200, 150)
	->toFile('image.jpg');
```

See the PHPDoc in the `Image` [class code](https://github.com/AigerTeam/ImageTools/blob/master/src/Image.php) for more details and the list of all methods.

Version compatibility
---------------------

[](#version-compatibility)

Versions are backward compatible within minor versions. For example versions `1.1.3` and `1.1.5` are backward compatible, but versions `1.1.3` and `1.2.1` may be not compatible. So we advice you to set a specific minor version in the composer configuration, for example `~1.0.7`.

License
-------

[](#license)

ImageTools is licensed under the MIT License. See the LICENSE file for details.

###  Health Score

24

—

LowBetter than 30% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~59 days

Recently: every ~103 days

Total

8

Last Release

3511d ago

PHP version history (2 changes)v1.0PHP &gt;=4.3.2

v1.0.1PHP &gt;=5.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9006227?v=4)[Sergey M.](/maintainers/Finesse)[@Finesse](https://github.com/Finesse)

---

Top Contributors

[![Finesse](https://avatars.githubusercontent.com/u/9006227?v=4)](https://github.com/Finesse "Finesse (42 commits)")

---

Tags

cropeditimageimmutablek-meansmodifyopacityphppictureresizerotatescreenshotstamptransparentwatermarkresizewatermarkimagesscreenshotpicturescropimmutablerotatek-meanstransparenteditmodifystampopacityprint text

### Embed Badge

![Health badge](/badges/aiger-team-image-tools/health.svg)

```
[![Health](https://phpackages.com/badges/aiger-team-image-tools/health.svg)](https://phpackages.com/packages/aiger-team-image-tools)
```

###  Alternatives

[sybio/image-workshop

Powerful PHP class using GD library to work easily with images including layer notion (like Photoshop or GIMP)

876953.8k12](/packages/sybio-image-workshop)[jbzoo/image

A PHP class that simplifies working with images

171130.3k3](/packages/jbzoo-image)[bodom78/kohana-imagefly

Create resized / cropped images directly through url parameters.

5518.3k](/packages/bodom78-kohana-imagefly)[ayvazyan10/nova-imagic

Imagic is a Laravel Nova field package that allows for image manipulation capabilities, such as cropping, resizing, quality adjustment, and WebP conversion. It utilizes the powerful Intervention Image class for image manipulation.

144.5k1](/packages/ayvazyan10-nova-imagic)

PHPackages © 2026

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