PHPackages                             christianberkman/imagick-text-box - 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. christianberkman/imagick-text-box

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

christianberkman/imagick-text-box
=================================

Add a simple text box to an image using PHP's Imagick Library

v1.2(2y ago)013MITPHP

Since Jun 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/christianberkman/imagick-text-box)[ Packagist](https://packagist.org/packages/christianberkman/imagick-text-box)[ RSS](/packages/christianberkman-imagick-text-box/feed)WikiDiscussions main Synced today

READMEChangelog (2)DependenciesVersions (3)Used By (0)

imagick-text-box
================

[](#imagick-text-box)

Add a simple text box to an image using PHP's Imagick Library

[![Example](https://raw.githubusercontent.com/christianberkman/imagick-text-box/main/example.jpg)](https://raw.githubusercontent.com/christianberkman/imagick-text-box/main/example.jpg)

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

[](#installation)

Composer:

`composer install christianberkman/imagick-text-box`

Usage
=====

[](#usage)

```
use \Imagick;
use ImagickTextBox\ImagickTextBox;

$image = new Imagick()->readImage('your-image.php');
$textBox = new ImagickTextBox($image);
$textBox->string = 'Hello World';
$textBox->draw(Imagick::GRAVITY_NORTHWEST);
```

Also see [example.php](https://github.com/christianberkman/imagick-text-box/blob/main/example.php) with a more detailed example of usage.

Public methods
==============

[](#public-methods)

- `void __construct(Imagick $image)`Construct the class and initialize ImagickDraw objects
- `void draw(int $gravity = Imagick::GRAVITY_SOUTHEST)` draw the textbox on the `Imagick $image` object
- `bool textFits()`Returns if the text fits on the given image

Public Properties
=================

[](#public-properties)

Imagick Objects
---------------

[](#imagick-objects)

All these objects are fully accessible and can be manipulated to set desired fill color, font size, etc.

- `Imagick $image` Your image object
- `ImagickDraw $text` Text object, initialized by ImagickTextBox
- `ImagickDraw $box` Box object, initializes by ImagickTextBox

Configuration
-------------

[](#configuration)

- `string $string = 'Hello World'` The string of text to print
- `int $margin_x = 10` Margin (px) from the side (does not apply to north, south, center)
- `int $margin_y = 10` Margin (px) from the top/bottom (does not apply to west, east, center)
- `int $padding = 5` Padding (px) of text inside text box
- `int $gravity = Imagick::GRAVITY_SOUTHWEST` Imagick Gravity Constant
- `float $heightFactor = 0.6` Height factor to use. By using the default font, a factor of 1 produces a text box with a lot of vertical whitespace, 0.6 seems to do the trick.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.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 ~9 days

Total

2

Last Release

749d ago

### Community

Maintainers

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

---

Top Contributors

[![christianatnacmu](https://avatars.githubusercontent.com/u/76948509?v=4)](https://github.com/christianatnacmu "christianatnacmu (5 commits)")[![christianberkman](https://avatars.githubusercontent.com/u/39840601?v=4)](https://github.com/christianberkman "christianberkman (2 commits)")

### Embed Badge

![Health badge](/badges/christianberkman-imagick-text-box/health.svg)

```
[![Health](https://phpackages.com/badges/christianberkman-imagick-text-box/health.svg)](https://phpackages.com/packages/christianberkman-imagick-text-box)
```

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

135911.1k3](/packages/goat1000-svggraph)[gravatarphp/gravatar

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

16653.6k2](/packages/gravatarphp-gravatar)[rsoury/wp-imgix

Rewrites WordPress image URLs to use ImgIX

167.2k](/packages/rsoury-wp-imgix)

PHPackages © 2026

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