PHPackages                             msztorc/image-processor - 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. msztorc/image-processor

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

msztorc/image-processor
=======================

ImageProcessor is a wrapper class for graphics libraries like GD2, ImageMagick and epeg.

1.2(9y ago)03.0kMITPHP

Since Jul 27Pushed 7y ago1 watchersCompare

[ Source](https://github.com/msztorc/ImageProcessor)[ Packagist](https://packagist.org/packages/msztorc/image-processor)[ RSS](/packages/msztorc-image-processor/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

[![Build Status](https://camo.githubusercontent.com/3d7ed24f57147500985ed518eb7bbfe4c1125b27192bde8a8dced9eceaf4d7e1/68747470733a2f2f7472617669732d63692e6f72672f6d737a746f72632f496d61676550726f636573736f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/msztorc/ImageProcessor)[![License](https://camo.githubusercontent.com/30597ff9a350144f03bffdd9183e16468e0b3ca1193e1d08591d992622738d55/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](http://www.opensource.org/licenses/MIT)

ImageProcessor Class
--------------------

[](#imageprocessor-class)

ImageProcessor is a wrapper class for graphics libraries like GD2, ImageMagick and epeg. Implements often used methods of graphics manipulation.

### Requirements

[](#requirements)

- GD2 (php extension)
- ImageMagick (PECL library)
- epeg (cli)

#### Library support for object

[](#library-support-for-object)

- GD2
- ImageMagick (PECL library)

#### Library support for static methods

[](#library-support-for-static-methods)

- ImageMagick (some functionality like resize, crop, effects)
- epeg (cli, only for epeg\_resize method)

### Usage Instructions

[](#usage-instructions)

Objected

```
$obj = new ImageProcessor('imagick', 'file.jpg'); // or 'gd' (default)
$obj->resize(100, 50, true, false); //width, height, aspect_ratio, enlarge
$obj->clear(); //free memory
```

Staticly image resize using ImageMagick (PECL extension)

```
ImageProcessor::imagick_resize('input-file.jpg', 'output-file.jpg', 800, 800); //infile, outfile, width, height, quality = 100, aspect_ratio = true, filter = imagick::FILTER_LANCZOS
```

Staticly image resize using epeg (cli)

```
ImageProcessor::epeg_resize('input-file.jpg', 'output-file.jpg', 800, 800); //infile, outfile, width, height, quality = 100, aspect_ratio = true
```

Load file

```
$obj = new ImageProcessor('imagick', 'infile.jpg');
// or
$obj2 = new ImageProcessor('gd', 'infile.jpg');

// clean constructor
$obj3 = new ImageProcessor(); //gd is default argument in constructor
$obj3->open('infile.jpg'); //open image
```

#### Base methods

[](#base-methods)

Grayscale

```
$obj->grayscale();
```

Negative

```
$obj->negative();
```

Brightness

```
$obj->brightness($threshold); // +/- 100
```

Colorize

```
$obj->colorize(80,90,60); //rgb
```

Sepia

```
$obj->sepia();
```

Custom Sepia

```
$obj->grayscale();
$obj->colorize(90,60,40);
```

Display image

```
$obj->display();
```

Save image

```
$obj->save('outfile.jpg', 99); //filename, JPEG quality
```

You can also work on image resource

```
$obj->image()->resizeImage(1200,1200, imagick::FILTER_LANCZOS, 1, true); //resize using Imagick object; object must be init with second argument 'imagick'
```

```
$obj = new ImageProcessor();
$obj->open_image('imagick', $file);
//$obj->image()->setOption('jpeg:size', '300x300'); //uncomment this if you want increase speed of resize
$obj->image()->resizeImage(300,300, imagick::FILTER_LANCZOS, 1, true);

$obj->save($outfile, 75);
$obj->display();
```

### Resize Performance

[](#resize-performance)

#### ImageMagick

[](#imagemagick)

JPEG image resize time from 5906x5906 to 1181x1181.

```
FILTER_POINT: 0.334532976151 sec
FILTER_BOX: 0.777871131897 sec
FILTER_TRIANGLE: 1.3695909977 sec
FILTER_HERMITE: 1.35866093636 sec
FILTER_HANNING: 4.88722896576 sec
FILTER_HAMMING: 4.88665103912 sec
FILTER_BLACKMAN: 4.89026689529 sec
FILTER_GAUSSIAN: 1.93553304672 sec
FILTER_QUADRATIC: 1.93322920799 sec
FILTER_CUBIC: 2.58396601677 sec
FILTER_CATROM: 2.58508896828 sec
FILTER_MITCHELL: 2.58368492126 sec
FILTER_LANCZOS: 3.74232912064 sec
FILTER_BESSEL: 4.03305602074 sec
FILTER_SINC: 4.90098690987 sec

```

CATROM has a very similar result to LANCZOS, but is significantly faster. ! Note! Above results are only demonstrative. Execution time depends upon the system configuration (processor speed, size of memory, etc...)

You can significantly speed up the processing bigger files using Imagick extension class by setting up `jpeg:size` option before open file:

```
$image = new Imagick();
$image->setOption('jpeg:size', '500x500');
$image->readImage('file.jpg');
```

or using ImageProcessor class

```
//$time_start = microtime(true);

$obj = new ImageProcessor('imagick');
$obj->image()->setOption('jpeg:size', '300x300');
$obj->open($file);

$obj->image()->resizeImage(300,300, imagick::FILTER_LANCZOS, 1, true);

$obj->save($outfile, 99);

//$time_end = microtime(true);
//$time = $time_end - $time_start;
//echo $time ."\n\n";
```

### Links

[](#links)

- epeg ()

### License

[](#license)

MIT

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

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

Total

3

Last Release

3310d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7062526?v=4)[Mirosław Sztorc](/maintainers/msztorc)[@msztorc](https://github.com/msztorc)

---

Top Contributors

[![msztorc](https://avatars.githubusercontent.com/u/7062526?v=4)](https://github.com/msztorc "msztorc (11 commits)")

---

Tags

imageimagickwrapperGD2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/msztorc-image-processor/health.svg)

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

###  Alternatives

[intervention/image

PHP Image Processing

14.3k203.8M2.5k](/packages/intervention-image)[league/glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.

2.6k52.6M140](/packages/league-glide)[intervention/image-laravel

Laravel Integration of Intervention Image

1588.9M161](/packages/intervention-image-laravel)[folklore/image

Image manipulation library for Laravel 5 based on Imagine and inspired by Croppa for easy url based manipulation

269248.6k5](/packages/folklore-image)[orbitale/imagemagick-php

A system that allows creating commands to send to the exec() function to use ImageMagick's powerful features.

42418.0k1](/packages/orbitale-imagemagick-php)[admad/cakephp-glide

CakePHP plugin for using Glide image manipulation library.

34165.3k1](/packages/admad-cakephp-glide)

PHPackages © 2026

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