PHPackages                             orbitale/imagemagick-php - 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. orbitale/imagemagick-php

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

orbitale/imagemagick-php
========================

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

v3.3.5(4mo ago)43406.9k↓23.6%15[1 issues](https://github.com/Orbitale/ImageMagickPHP/issues)[1 PRs](https://github.com/Orbitale/ImageMagickPHP/pulls)1MITPHPPHP ^7.2|^8.0CI failing

Since Feb 26Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/Orbitale/ImageMagickPHP)[ Packagist](https://packagist.org/packages/orbitale/imagemagick-php)[ Docs](https://github.com/Orbitale/ImageMagickPHP)[ GitHub Sponsors](https://github.com/pierstoval)[ RSS](/packages/orbitale-imagemagick-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (3)Versions (42)Used By (1)

ImageMagickPHP
==============

[](#imagemagickphp)

An ImageMagick "exec" component for PHP apps.

Installation
============

[](#installation)

Install with [Composer](https://getcomposer.org/), it's the best packages manager you can have :

```
composer require orbitale/imagemagick-php
```

Requirements
============

[](#requirements)

- PHP 7.2 or higher
- [ImageMagick 7](https://www.imagemagick.org/) has to be installed on your server, and the binaries must be executable by the user running the PHP process.

Settings
========

[](#settings)

There are not many settings, but when you instantiate a new `Command` object, you may specify ImageMagick's executable directory directly in the constructor, for example :

```
use Orbitale\Component\ImageMagick\Command;

// Default directory for many Linux distributions
$command = new Command('/usr/bin/magick');

// Or in Windows, depending of the install directory
$command = new Command('C:\ImageMagick\magick.exe');

// Will try to automatically discover the path of ImageMagick in your system
// Note: it uses Symfony's ExecutableFinder to find it in $PATH
$command = new Command();
```

The constructor will automatically search for the `magick` executable, test it, and throw an exception if it's not available.

⚠️ Make sure your ImageMagick binary is executable.

Usage
=====

[](#usage)

First, we recommend you to note all possible scripts that you can use with ImageMagick in the [official docs](https://imagemagick.org/script/command-line-tools.php):

- [animate](https://imagemagick.org/script/animate.php)
- [compare](https://imagemagick.org/script/compare.php)
- [composite](https://imagemagick.org/script/composite.php)
- [conjure](https://imagemagick.org/script/conjure.php)
- [convert](https://imagemagick.org/script/convert.php)
- [display](https://imagemagick.org/script/display.php)
- [identify](https://imagemagick.org/script/identify.php)
- [import](https://imagemagick.org/script/import.php)
- [mogrify](https://imagemagick.org/script/mogrify.php)
- [montage](https://imagemagick.org/script/montage.php)
- [stream](https://imagemagick.org/script/stream.php)

These correspond to the "legacy binaries", and you can use them if you are familiar or comfortable with them.

As of ImageMagick 7, these are not mandatory, but this package is compatible with them.

### Basic image type converter with ImageMagick's basic logo

[](#basic-image-type-converter-with-imagemagicks-basic-logo)

Read the comments :

```
require_once 'vendor/autoload.php';

use Orbitale\Component\ImageMagick\Command;

// Create a new command
$command = new Command();

$response = $command
    // The command will search for the "logo.png" file. If it does not exist, it will throw an exception.
    // If it does, it will create a new command with this source image.
    ->convert('logo.png')

    // The "output()" method will append "logo.gif" at the end of the command-line instruction as a filename.
    // This way, we can continue writing our command without appending "logo.gif" ourselves.
    ->output('logo.gif')

    // At this time, the command shall look like this :
    // $ "{ImageMagickPath}convert" "logo.png" "logo.gif"

    // Then we run the command by using "exec()" to get the CommandResponse
    ->run()
;

// Check if the command failed and get the error if needed
if ($response->hasFailed()) {
    throw new Exception('An error occurred:'.$response->getError());
} else {
    // If it has not failed, then we simply send it to the buffer
    header('Content-type: image/gif');
    echo file_get_contents('logo.gif');
}
```

### Resizing an image

[](#resizing-an-image)

```
require_once 'vendor/autoload.php';

use Orbitale\Component\ImageMagick\Command;

// Create a new command
$command = new Command();

$response = $command

    ->convert('background.jpeg')

    // We'll use the same output as the input, therefore will overwrite the source file after resizing it.
    ->output('background.jpeg')

    // The "resize" method allows you to add a "Geometry" operation.
    // It must fit to the "Geometry" parameters in the ImageMagick official documentation (see links below & phpdoc)
    ->resize('50x50')

    ->run()
;

// Check if the command failed and get the error if needed
if ($response->hasFailed()) {
    throw new Exception('An error occurred:'.$response->getError());
} else {
    // If it has not failed, then we simply send it to the buffer
    header('Content-type: image/gif');
    echo file_get_contents('logo.gif');
}
```

### Currently supported options:

[](#currently-supported-options)

There are **a lot** of command-line options, and each have its own validation system.

This is why a "few" ones are implemented now, to make sure validation is possible for each of them.

**Note:** If an option is not implemented in the `Command` class, you can create an issue or make a Pull Request that implements the new option!

- [`-annotate`](http://www.imagemagick.org/script/command-line-options.php#annotate)
- [`-background`](http://www.imagemagick.org/script/command-line-options.php#background)
- [`-blur`](http://www.imagemagick.org/script/command-line-options.php#blur)
- [`-colorspace`](http://www.imagemagick.org/script/command-line-options.php#colorspace)
- [`-crop`](http://www.imagemagick.org/script/command-line-options.php#crop)
- [`-depth`](http://www.imagemagick.org/script/command-line-options.php#depth)
- [`-draw`](http://www.imagemagick.org/script/command-line-options.php#draw)
- [`-extent`](http://www.imagemagick.org/script/command-line-options.php#extent)
- [`-fill`](http://www.imagemagick.org/script/command-line-options.php#fill)
- [`-flatten`](http://www.imagemagick.org/script/command-line-options.php#flatten)
- [`-font`](http://www.imagemagick.org/script/command-line-options.php#font)
- [`-gaussian-blur`](http://www.imagemagick.org/script/command-line-options.php#gaussian-blur)
- [`-gravity`](http://www.imagemagick.org/script/command-line-options.php#gravity)
- [`-interlace`](http://www.imagemagick.org/script/command-line-options.php#interlace)
- [`-monochrome`](http://www.imagemagick.org/script/command-line-options.php#monochrome)
- [`-pointsize`](http://www.imagemagick.org/script/command-line-options.php#pointsize)
- [`-quality`](http://www.imagemagick.org/script/command-line-options.php#quality)
- [`-resize`](http://www.imagemagick.org/script/command-line-options.php#resize)
- [`-rotate`](http://www.imagemagick.org/script/command-line-options.php#rotate)
- [`-size`](http://www.imagemagick.org/script/command-line-options.php#size)
- [`-strip`](http://www.imagemagick.org/script/command-line-options.php#strip)
- [`-stroke`](http://www.imagemagick.org/script/command-line-options.php#stroke)
- [`-thumbnail`](http://www.imagemagick.org/script/command-line-options.php#thumbnail)
- [`-transpose`](http://www.imagemagick.org/script/command-line-options.php#transpose)
- [`-transverse`](http://www.imagemagick.org/script/command-line-options.php#transverse)
- [`xc:`](http://www.imagemagick.org/Usage/canvas/)

Feel free to ask/create an issue if you need more!

### Some aliases that do magic for you:

[](#some-aliases-that-do-magic-for-you)

- `$command->text()`: This method uses multiple options added to the `-annotate` one to generate a text block. You must specify its position and size, but you can specify color and the font file used.
- `$command->ellipse()`: (check source code for the heavy prototype!) This method uses the `-stroke`, `-fill` and `-draw` options to create an ellipse/circle/disc on your picture. **Note:** I recommend to check both the source code and the documentation to be sure of what you are doing.

Useful links
============

[](#useful-links)

- ImageMagick official website:
- ImageMagick documentation:
    - [Installation of the binaries](https://www.imagemagick.org/script/download.php) (depending on your OS and/or distribution)
    - [Geometry option](https://www.imagemagick.org/script/command-line-processing.php#geometry) (to resize or place text)
    - [All command-line options](https://imagemagick.org/script/command-line-options.php) ; they're not all available in this tool for now, so feel free to make a PR ! ;)

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance77

Regular maintenance activity

Popularity49

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 78.4% 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 ~108 days

Recently: every ~195 days

Total

38

Last Release

120d ago

Major Versions

v1.6.1 → v2.0.02018-01-19

v2.0.2 → v3.0.02019-03-05

PHP version history (5 changes)v1.0.0PHP &gt;=5.3.3

v1.6.0PHP &gt;=5.4

v2.0.0PHP ^7.1

v3.0.0PHP ^7.2

v3.0.14PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/287671e403432448ba0e76aefac027294e5117497df9f9c06f0c45f3d2d75415?d=identicon)[Pierstoval](/maintainers/Pierstoval)

---

Top Contributors

[![Pierstoval](https://avatars.githubusercontent.com/u/3369266?v=4)](https://github.com/Pierstoval "Pierstoval (182 commits)")[![JeffAlyanak](https://avatars.githubusercontent.com/u/16124077?v=4)](https://github.com/JeffAlyanak "JeffAlyanak (16 commits)")[![Orbitaleio](https://avatars.githubusercontent.com/u/11873790?v=4)](https://github.com/Orbitaleio "Orbitaleio (11 commits)")[![fariasmaiquita](https://avatars.githubusercontent.com/u/6787828?v=4)](https://github.com/fariasmaiquita "fariasmaiquita (7 commits)")[![VincentLanglet](https://avatars.githubusercontent.com/u/9052536?v=4)](https://github.com/VincentLanglet "VincentLanglet (6 commits)")[![pbories](https://avatars.githubusercontent.com/u/40885411?v=4)](https://github.com/pbories "pbories (3 commits)")[![jonasschmidt95](https://avatars.githubusercontent.com/u/14967028?v=4)](https://github.com/jonasschmidt95 "jonasschmidt95 (2 commits)")[![davoinb](https://avatars.githubusercontent.com/u/11584956?v=4)](https://github.com/davoinb "davoinb (1 commits)")[![jgon6](https://avatars.githubusercontent.com/u/1424393?v=4)](https://github.com/jgon6 "jgon6 (1 commits)")[![jansed26](https://avatars.githubusercontent.com/u/4061123?v=4)](https://github.com/jansed26 "jansed26 (1 commits)")[![SchmidtClaudia](https://avatars.githubusercontent.com/u/1684565?v=4)](https://github.com/SchmidtClaudia "SchmidtClaudia (1 commits)")[![derrabus](https://avatars.githubusercontent.com/u/1506493?v=4)](https://github.com/derrabus "derrabus (1 commits)")

---

Tags

application-wrapperhacktoberfestimagemagickoop-interfacephpimageImageMagickgdimagickconverter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/orbitale-imagemagick-php/health.svg)

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

###  Alternatives

[intervention/image

PHP Image Processing

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

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

2.8k52.6M137](/packages/league-glide)[intervention/image-laravel

Laravel Integration of Intervention Image

1558.1M158](/packages/intervention-image-laravel)[james-heinrich/phpthumb

The PHP thumbnail generator

317545.2k18](/packages/james-heinrich-phpthumb)[admad/cakephp-glide

CakePHP plugin for using Glide image manipulation library.

34165.3k1](/packages/admad-cakephp-glide)[phpixie/image

PHPixie imageprocessing library

5356.9k6](/packages/phpixie-image)

PHPackages © 2026

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