PHPackages                             meriksk/php-image - 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. meriksk/php-image

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

meriksk/php-image
=================

PHP class to re-size and scale images

v0.2(2mo ago)088MITPHPPHP &gt;=8.1

Since Jul 27Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/meriksk/php-image)[ Packagist](https://packagist.org/packages/meriksk/php-image)[ Docs](https://github.com/meriksk)[ RSS](/packages/meriksk-php-image/feed)WikiDiscussions master Synced 1mo ago

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

PHP-Image Library
=================

[](#php-image-library)

[![Latest Stable Version](https://camo.githubusercontent.com/90247ae31ec2162904cbd007c234592459558ef63c71d97447e86c643d0cd2bc/687474703a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6d6572696b736b2f7068702d696d6167652e737667)](https://packagist.org/packages/meriksk/php-image)[![License](https://camo.githubusercontent.com/22ba079faafc7eaf0106ea7b8af2a25f2c222cd3284a995a3937e6797831f5b9/68747470733a2f2f706f7365722e707567782e6f72672f6d6572696b736b2f7068702d696d6167652f6c6963656e7365)](https://packagist.org/packages/meriksk/php-image)

> The Image class offers a bunch of image processing features using GD or IMagick.

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

[](#requirements)

- PHP &gt;=8.1

Supported Image Libraries
-------------------------

[](#supported-image-libraries)

- GD Library (&gt;=2.0)
- Imagick PHP extension (&gt;=6.5.7)

---

Setup
-----

[](#setup)

The preferred way to install this extension is through [Composer](https://getcomposer.org/). If you do not have [Composer](https://getcomposer.org/), you may install it by following the instructions at [getcomposer.org](https://getcomposer.org/).

Either run

```
composer require meriksk/php-image

```

or add

```
"meriksk/php-image": "~1.0"

```

to your composer.json and run composer update

Usage
-----

[](#usage)

- [Open image](#open-image)
- [Resize image](#resize-image)
- [Crop image](#crop-image)

Open image
----------

[](#open-image)

Because this class uses namespacing, when instantiating the object, you need to either use the fully qualified namespace:

```
$image = new \meriksk\PhpImage\Image($filename);
```

or alias it:

```
use \meriksk\PhpImage\Image;

$image = new Image($filename);
```

This class can use Imagick or GD extension - whichever is available. Imagick extension is preferred if is available. You can force the extension for manipulating images as follows:

```
$image = new Image($filename, Image::DRIVER_IMAGICK);
```

Save image
----------

[](#save-image)

Library supports three formats of image: 'jpeg', 'png' and 'gif'. By default they quality is set to 75. When saving to disk or outputting into the browser, the script assumes the same output type and quality as input.

```
$image->save($filename);
```

Save in a different type to the source:

```
$image->save($filename, 60, 'png');
```

Output image
------------

[](#output-image)

To render the image directly into the browser, you can call:

```
$image->toScreen(60, 'png');
```

Resize
------

[](#resize)

resize

```
$image = $image->resize($width, $height, $allow_enlarge);
```

resize to width

```
$image = $image->resizeToWidth($width, $allow_enlarge);
```

resize to height

```
$image = $image->resizeToHeight($height, $allow_enlarge);
```

resize to best fit

```
$image = $image->resizeToBestFit($max_width, $max_height, $allow_enlarge);
```

resize to long side

```
$image = $image->resizeToLongSide($max, $allow_enlarge);
```

resize to short side

```
$image = $image->resizeToShortSide($max, $allow_enlarge);
```

Crop
----

[](#crop)

manual crop

```
$image->crop($x, $y, $width, $height, $allow_enlarge);
```

automatic crop

```
$image->autoCrop($width, $height, $position);
```

Thumbnail
---------

[](#thumbnail)

```
$image->thumbnail($width, $height, $fill, $allow_enlarge);
```

Rotate image
------------

[](#rotate-image)

Rotating is counter clockwise;

Rotate on 90 degrees:

```
$image->rotate(90);
```

Rotate on 45 degrees, and fill empty field with white color:

```
$image->rotate(45, '#FFFFFF');
```

Flip image
----------

[](#flip-image)

Flip in vertical direction:

```
$image->flip();
```

Flip in horisontal direction:

```
$image->flip(Image::FLIP_HORIZONTAL);
```

Flip in both directions:

```
$image->flip(Image::FLIP_BOTH);
```

Filters
-------

[](#filters)

todo

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance83

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

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

Total

2

Last Release

84d ago

PHP version history (2 changes)0.1PHP &gt;=5.6.0

v0.2PHP &gt;=8.1

### Community

Maintainers

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

---

Top Contributors

[![meriksk](https://avatars.githubusercontent.com/u/8442739?v=4)](https://github.com/meriksk "meriksk (2 commits)")

---

Tags

thumbnailimagegdimagickresizescale

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/meriksk-php-image/health.svg)

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

###  Alternatives

[intervention/image

PHP Image Processing

14.3k194.3M2.2k](/packages/intervention-image)[intervention/image-laravel

Laravel Integration of Intervention Image

1536.5M102](/packages/intervention-image-laravel)[sybio/image-workshop

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

860918.1k11](/packages/sybio-image-workshop)[folklore/image

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

270248.2k5](/packages/folklore-image)[jbzoo/image

A PHP class that simplifies working with images

171126.9k3](/packages/jbzoo-image)[stefangabos/zebra_image

A single-file, lightweight PHP library designed for efficient image manipulation featuring methods for modifying images and applying filters

141110.4k6](/packages/stefangabos-zebra-image)

PHPackages © 2026

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