PHPackages                             landlib/text2png - 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. landlib/text2png

ActiveLibrary

landlib/text2png
================

This is configurable library for create png image from text on the background png image

012PHP

Since Dec 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/lamzin-andrey/text2png)[ Packagist](https://packagist.org/packages/landlib/text2png)[ RSS](/packages/landlib-text2png/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

En
==

[](#en)

About
-----

[](#about)

This is configurable library for create png image from text on the background png image (use gd library).

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

[](#installation)

`composer require landlib/text2png`

or

`git clone https://github.com/lamzin-andrey/text2png`

Usage
-----

[](#usage)

```
use \Landlib\Text2Png;

$o = new Text2Png('Hello world' );
$o->setFontSize(34);
$o->setPaddingTop(40);
$o->setFontColor([200 , 0, 0]);//r, g, b
//result image size defined background image. Default background image is white 261x44 pixels.
$o->save(__DIR__ . '/out.png');
```

You can configure font family, size, color and background image:

```
use \Landlib\Text2Png;

$o = new Text2Png('Hello world');
$o->setFontSize(40);
$o->setPaddingTop(10);
$o->setPaddingLeft(20);
$o->setFontColor([255 , 127, 0]);//r, g, b
$o->setBgImage($_SERVER['DOCUMENT_ROOT'] . '/images/background_400px_320px.png');
$o->setFont($_SERVER['DOCUMENT_ROOT'] . '/fonts/arial.ttf');
//result image size defined background image. Default background image is white 261x44 pixels.
$o->save(__DIR__ . '/out.png');
```

If you can no save image, but send png image as server response, use Text2Png::pngResponse() method:

```
use \Landlib\Text2Png;

$o = new Text2Png('Hello world');
$o->setFontSize(40);
$o->setPaddingTop(10);
$o->setPaddingLeft(20);
$o->setFontColor([255 , 127, 0]);//r, g, b
$o->setBgImage($_SERVER['DOCUMENT_ROOT'] . '/images/background_400px_320px.png');
$o->setFont($_SERVER['DOCUMENT_ROOT'] . '/fonts/arial.ttf');
$o->setText('Welcome!');
//result image size defined background image. Default background image is white 261x44 pixels.
$o->pngResponse(); //Content-Type: image/png and image bytes.
```

Ru
==

[](#ru)

Что это
-------

[](#что-это)

Это конфигурируемая библиотека для создания изображений в формате png из текста (использует библиотеку gd).

Установка
---------

[](#установка)

`composer require landlib/text2png`

или

`git clone https://github.com/lamzin-andrey/text2png`

Использование
-------------

[](#использование)

```
use \Landlib\Text2Png;

$o = new Text2Png('Hello world' );
$o->setFontSize(34);
$o->setPaddingTop(40);
$o->setFontColor([200 , 0, 0]);//r, g, b
//Размер выходного изображения определяет фоновое изображение. Фоновое изображение по умолчанию - это белый прямоугольник 261x44 пикселей.
$o->save(__DIR__ . '/out.png');
```

Вы можете конфигурировать шрифт, размер и фоновое изображение:

```
use \Landlib\Text2Png;

$o = new Text2Png('Hello world');
$o->setFontSize(40);
$o->setPaddingTop(10);
$o->setPaddingLeft(20);
$o->setFontColor([255 , 127, 0]);//r, g, b
$o->setBgImage($_SERVER['DOCUMENT_ROOT'] . '/images/background_400px_320px.png');
$o->setFont($_SERVER['DOCUMENT_ROOT'] . '/fonts/arial.ttf');

$o->save(__DIR__ . '/out.png');
```

Если вы не хотите сохранять изображение на диск сервера, используйте метод Text2Png::pngResponse():

```
use \Landlib\Text2Png;

$o = new Text2Png('Hello world');
$o->setFontSize(40);
$o->setPaddingTop(10);
$o->setPaddingLeft(20);
$o->setFontColor([255 , 127, 0]);//r, g, b
$o->setBgImage($_SERVER['DOCUMENT_ROOT'] . '/images/background_400px_320px.png');
$o->setFont($_SERVER['DOCUMENT_ROOT'] . '/fonts/arial.ttf');
$o->setText('Welcome!');
//Размер выходного изображения определяет фоновое изображение. Фоновое изображение по умолчанию - это белый прямоугольник 261x44 пикселей.
$o->pngResponse(); //Заголовок Content-Type: image/png и байты изображения
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c515a68fa757958c4b37cf7c3083ad210d9be2a6059b7a255bd8c23856abfe0?d=identicon)[lamzin](/maintainers/lamzin)

---

Top Contributors

[![lamzin-andrey](https://avatars.githubusercontent.com/u/7406021?v=4)](https://github.com/lamzin-andrey "lamzin-andrey (4 commits)")

### Embed Badge

![Health badge](/badges/landlib-text2png/health.svg)

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

PHPackages © 2026

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