PHPackages                             gwa/gw-image-editor - 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. gwa/gw-image-editor

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

gwa/gw-image-editor
===================

Simple PHP image manipulation library

v3.3.2(10y ago)44.0k1[1 issues](https://github.com/gwa/gwImageEditor/issues)MITPHPPHP &gt;=5.4

Since Jun 2Pushed 10y ago6 watchersCompare

[ Source](https://github.com/gwa/gwImageEditor)[ Packagist](https://packagist.org/packages/gwa/gw-image-editor)[ Docs](https://github.com/gwa/gwImageEditor)[ RSS](/packages/gwa-gw-image-editor/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (2)Versions (11)Used By (0)

gwImageEditor
=============

[](#gwimageeditor)

A PHP image editor library that uses the bundled GD library.

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/56c3113ca3d6adbe8b5a877efd65ba912e2648731ae5eae47dd38fe7e7f6b8bc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6777612f6777496d616765456469746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/gwa/gwImageEditor/?branch=master) [![Build Status](https://camo.githubusercontent.com/d3a7d2d988febb616d1cc893d3455eac7b898eadf652dfcb0ada8c970b6a2a1a/68747470733a2f2f6170692e7472617669732d63692e6f72672f6777612f6777496d616765456469746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/gwa/gwImageEditor)

Provides a simple and intuitive interface for typical editing, cropping, resizing and filtering actions on existing images.

Typical use cases:

- Scaling and cropping uploaded images to within constraints
- Creating different sized versions of an image
- Adding watermarks

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

[](#installation)

Install through composer:

`composer require gwa/gw-image-editor`

Usage
-----

[](#usage)

```
use Gwa\Image\ImageEditor;

// create an editor using an existing image
$editor = new ImageEditor('path/to/image.png');

// resize image to within 640 x 480 px, maintaining aspect ratio
$editor->resizeToWithin(640, 480)
    ->save();

// resize image to exactly 640 x 480 px, cropping any overhang
$editor->resizeTo(640, 480)
    ->save();

// resize image to exactly 640px width, preserving aspect ratio
$editor->resizeTo(640)
    ->save();

// resize image to exactly 480px height, preserving aspect ratio
$editor->resizeTo(null, 480)
    ->save();

// crop the image: x, y, width, height
$editor->crop(10, 10, 100, 100)
    ->save();

// methods can be chained
// - create and save medium image with max width and height of 500px
// - create and save thumbnail image with exact dimensions of 100px x 100px
$editor = new ImageEditor('path/to/original.jpg');
$editor->resizeToWithin(500, 500)
    ->saveAs('path/to/medium.jpg')
    ->resizeTo(100, 100)
    ->saveAs('path/to/thumbnail.jpg')
    ->saveAs('path/to/thumbnail.png', IMAGETYPE_PNG);

// another image can be "pasted" in (e.g. a watermark)
// - paste watermark into bottom right corner
$editor = new ImageEditor('path/to/original.jpg');
$iw = $editor->getWidth();
$ih = $editor->getHeight();

$watermark = new ImageEditor('path/to/watermark.png');
$ww = $watermark->getWidth();
$wh = $watermark->getHeight();

$padding = 10;

$editor->pasteImage($watermark, $iw - $ww - $padding, $ih - $wh - $padding)
    ->saveAs('path/to/watermarked.jpg');

// there are also filter methods available
$editor = new ImageEditor('path/to/original.jpg');
$editor->grayscale()
    ->coloroverlay(0, 0, 0, 50) // 50% black overlay
    ->colorize(255, 0, 0, 0) // rgba
```

Tests
-----

[](#tests)

PHPUnit

```
$ ./vendor/bin/phpunit -c tests/phpunit.xml --coverage-html=tests/_report tests

```

Code style (PSR-2)

```
$ ./vendor/bin/phpcs --standard=PSR2 src

```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 92.7% 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 ~77 days

Recently: every ~86 days

Total

10

Last Release

3712d ago

Major Versions

1.0.0 → v2.02014-09-03

v2.0 → v3.02015-05-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/ff4c484be9fc46201a1c3c13fc961525d699d1c4e7dda68df7c5b408f147228a?d=identicon)[gwa](/maintainers/gwa)

---

Top Contributors

[![gwagroves](https://avatars.githubusercontent.com/u/8222012?v=4)](https://github.com/gwagroves "gwagroves (38 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")[![prisis](https://avatars.githubusercontent.com/u/2716058?v=4)](https://github.com/prisis "prisis (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/gwa-gw-image-editor/health.svg)

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

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

133890.0k3](/packages/goat1000-svggraph)[imagekit/imagekit

PHP library for Imagekit

46877.3k10](/packages/imagekit-imagekit)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

12644.1k2](/packages/gravatarphp-gravatar)

PHPackages © 2026

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