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

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

msgframework/image
==================

This library help to manipulate with images: crop, resize, change quality and watermarking.

v0.7.18(4y ago)117MITPHPPHP &gt;=7.4

Since Jan 7Pushed 4y ago1 watchersCompare

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

READMEChangelog (6)Dependencies (3)Versions (7)Used By (0)

The Image library
=================

[](#the-image-library)

[![Latest Stable Version](https://camo.githubusercontent.com/6e488dc59deb2e18d73ac7d0dc6ea136a12bd5cf4fa7e6f29d631aca4c31b4f3/687474703a2f2f706f7365722e707567782e6f72672f6d73676672616d65776f726b2f696d6167652f76)](https://packagist.org/packages/msgframework/image) [![Total Downloads](https://camo.githubusercontent.com/8e9fb2b1d84d2d0aa849d20afeb981ddaff91db0ba821e13b4cf606c1fecf99f/687474703a2f2f706f7365722e707567782e6f72672f6d73676672616d65776f726b2f696d6167652f646f776e6c6f616473)](https://packagist.org/packages/msgframework/image) [![Latest Unstable Version](https://camo.githubusercontent.com/b113e72bbb16bd2aa112496cb43488fd2ab0a93e907c4ec32bfa2188901a2d03/687474703a2f2f706f7365722e707567782e6f72672f6d73676672616d65776f726b2f696d6167652f762f756e737461626c65)](https://packagist.org/packages/msgframework/image) [![License](https://camo.githubusercontent.com/c725e0188deedcf47209b6d29e057398644511a38b7e0f33241ff90ad427ebdc/687474703a2f2f706f7365722e707567782e6f72672f6d73676672616d65776f726b2f696d6167652f6c6963656e7365)](https://packagist.org/packages/msgframework/image) [![PHP Version Require](https://camo.githubusercontent.com/6bbdd2246d3fcf1ddd7787658492f3b19a2722f617237d37e771fc6d9cdc6289/687474703a2f2f706f7365722e707567782e6f72672f6d73676672616d65776f726b2f696d6167652f726571756972652f706870)](https://packagist.org/packages/msgframework/image)

About
-----

[](#about)

This library help to manipulate with images: crop, resize, change quality and watermarking.

Usage
-----

[](#usage)

### Load ImageFactory

[](#load-imagefactory)

```
use Msgframework\Lib\Image\ImageFactory;
use Msgframework\Lib\Image\Adapter\ImageAdapter;
...
// Create factory
$factory = new ImageFactory();
```

### Create Image with ImageFactory

[](#create-image-with-imagefactory)

```
...
$factory = new ImageFactory();

// Create ImageAdapter from $path with auto selected Adapter
$image = $factory->getImage($path);

// Create ImagickAdapter from $path
$image = $factory->getImage($path, 'Imagick');

// Create GDAdapter from $path
$image = $factory->getImage($path, 'GD');
```

### Create Image without ImageFactory

[](#create-image-without-imagefactory)

```
...
// Create ImagickAdapter from $path
$image = new \Msgframework\Lib\Image\Adapter\ImagickAdapter($path);

// Create GDAdapter from $path
$image = new \Msgframework\Lib\Image\Adapter\GDAdapter($path);
```

### Get Image dimensions

[](#get-image-dimensions)

```
...
$image = $factory->getImage($path);

$image->getWidth(); // Return width in px
$image->getHeight(); // Return height in px
```

### Resize Image

[](#resize-image)

```
...
$image = $factory->getImage($path);

$image->resize(300, ImageAdapter::SIDE_WIDTH); // Set image width 300px
...
$image->resize(500, ImageAdapter::SIDE_HEIGHT); // Set image width 500px
$image->resize(800, ImageAdapter::SIDE_AUTO); // Set image width/height 800px by longest side
```

### Scale Image

[](#scale-image)

Used to scale to a given value on a specified side

```
...
$image = $factory->getImage($path);

$image->scale(300, ImageAdapter::SIDE_WIDTH); // Set image width 300px and scaled height
```

### Crop Image

[](#crop-image)

Allows you to crop the image to a specified size without the appearance of voids

```
...
$image = $factory->getImage($path);

$image->crop(300, 500);
// If a similar image had dimensions of 400x400px, then the output will be an image of 300x400px
```

### Change Image opacity

[](#change-image-opacity)

Allows you to change the transparency of the image as a percentage from 0 to one hundred

```
...
$image = $factory->getImage($path);

$image->opacity(.5);
// Accepts float values from 0 to 1
```

### Change Image quality

[](#change-image-quality)

Allows you to specify the image quality in percentage

```
...
$image = $factory->getImage($path);

$image->quality(80);
// Accepts int values from 0 to 100
```

### Save changed Image

[](#save-changed-image)

```
...
$image = $factory->getImage($path);
...
$image->save($image->getPathName()); // Owerwrite Image
$image->save($newpath); // Save new Image
```

### Show Image

[](#show-image)

If you need to display modified images by link without storing them, for example, implement a preview

```
...
$image = $factory->getImage($path);
...
$image->resize(600, ImageAdapter::SIDE_WIDTH);
$image->show();
```

### Watermarking Image

[](#watermarking-image)

```
...
$image = $factory->getImage($pathImage);
$watermark = $factory->getImage($pathWatermark);
...
$image->watermark($watermark, ImageAdapter::WATERMARK_CENTER_CENTER, 20, 70, 70);
$image->save();
```

### Watermark position codes

[](#watermark-position-codes)

To position the watermark, you can use both ImageAdapter constants and codes from the table

LeftCenterRightTop123Center456Bottom789### Destroy Image

[](#destroy-image)

If you have finished manipulating the image but still want to work on the file

```
...
$image = $factory->getImage($path);
...
$image->save()->destroy();
...
$dirPath = $image->getPath(); // Get path to image directory
```

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

[](#installation)

You can install this package easily with [Composer](https://getcomposer.org/).

Just require the package with the following command:

```
$ composer require msgframework/image

```

Asset
-----

[](#asset)

All images used for PHPUnit tests were downloaded from the site unsplash.com

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

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

Total

6

Last Release

1504d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6879a1f83db6685dc9507b7ad0660480e48e173c053147f3202bdb8d2e4f3bfb?d=identicon)[MSGroupFM](/maintainers/MSGroupFM)

---

Top Contributors

[![MSGroupFM](https://avatars.githubusercontent.com/u/10297569?v=4)](https://github.com/MSGroupFM "MSGroupFM (7 commits)")

---

Tags

image-manipulationphpimagegdimagickresizewatermark

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[intervention/image

PHP Image Processing

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

Laravel Integration of Intervention Image

1496.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)[intervention/image-symfony

Symfony Integration of Intervention Image

1066.8k](/packages/intervention-image-symfony)

PHPackages © 2026

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