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(1y ago)013MITPHP

Since Jun 4Pushed 1y 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 1mo ago

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

23

—

LowBetter than 27% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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

698d 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

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[char0n/ffmpeg-php

PHP wrapper for FFmpeg application

495225.1k1](/packages/char0n-ffmpeg-php)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)

PHPackages © 2026

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