PHPackages                             andrewgjohnson/imagecolorallocatefromstring - 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. andrewgjohnson/imagecolorallocatefromstring

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

andrewgjohnson/imagecolorallocatefromstring
===========================================

imagecolorallocatefromstring is a function that will allocate a color based on a string for your PHP GD images

v1.0.2(3y ago)115[1 issues](https://github.com/andrewgjohnson/imagecolorallocatefromstring/issues)1MITPHPPHP &gt;=5.0.0

Since Dec 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/andrewgjohnson/imagecolorallocatefromstring)[ Packagist](https://packagist.org/packages/andrewgjohnson/imagecolorallocatefromstring)[ Docs](https://imagecolorallocatefromstring.agjgd.org)[ GitHub Sponsors](https://github.com/andrewgjohnson)[ Patreon](https://www.patreon.com/agjgd)[ RSS](/packages/andrewgjohnson-imagecolorallocatefromstring/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (1)

imagecolorallocatefromstring
============================

[](#imagecolorallocatefromstring)

[![MIT License](https://camo.githubusercontent.com/04922227901ae9b0742e739b586a385fdacbb439766ee50870ea8db097378794/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d3033363664362e706e673f636f6c6f72423d303336366436267374796c653d666c61742d737175617265)](https://github.com/andrewgjohnson/imagecolorallocatefromstring/blob/master/LICENSE)[![Current Release](https://camo.githubusercontent.com/4ce6b640ab4a7ddc0bbce3762ee142b938e9c640fb398e7ebcff97330ca78b9e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f616e64726577676a6f686e736f6e2f696d616765636f6c6f72616c6c6f6361746566726f6d737472696e672e706e673f636f6c6f72423d303336366436267374796c653d666c61742d737175617265266c6f676f436f6c6f723d7768697465266c6f676f3d676974687562)](https://github.com/andrewgjohnson/imagecolorallocatefromstring/releases)[![Contributors](https://camo.githubusercontent.com/f773a8f68dc74a657e57432df3b87d605b16a3c28e90419244df650924972610/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f616e64726577676a6f686e736f6e2f696d616765636f6c6f72616c6c6f6361746566726f6d737472696e672e706e673f636f6c6f72423d303336366436267374796c653d666c61742d737175617265266c6f676f436f6c6f723d7768697465266c6f676f3d676974687562)](https://github.com/andrewgjohnson/imagecolorallocatefromstring/graphs/contributors)[![Packagist Downloads](https://camo.githubusercontent.com/c6df9a40b25cdc16f76860d9976067eb11d37efa6cf1044fa3c9b490a6f8c8da/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e64726577676a6f686e736f6e2f696d616765636f6c6f72616c6c6f6361746566726f6d737472696e672e706e673f636f6c6f72423d303336366436267374796c653d666c61742d737175617265266c6f676f436f6c6f723d7768697465266c6f676f3d7061636b6167697374)](https://packagist.org/packages/andrewgjohnson/imagecolorallocatefromstring/stats)[![Issues](https://camo.githubusercontent.com/299fcc38cd60430ef8751e40da586f7eac8fe03e0e4789d0fd81fb7ddcf35fcd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f616e64726577676a6f686e736f6e2f696d616765636f6c6f72616c6c6f6361746566726f6d737472696e672e706e673f636f6c6f72423d303336366436267374796c653d666c61742d737175617265266c6f676f436f6c6f723d7768697465266c6f676f3d676974687562)](https://github.com/andrewgjohnson/imagecolorallocatefromstring/issues)[![Patreon](https://camo.githubusercontent.com/76b6aa6e329a7b193e2bd48b4262663ddfce5ad5d94758951feb4b037158f24b/68747470733a2f2f696d616765636f6c6f72616c6c6f6361746566726f6d737472696e672e61676a67642e6f72672f646f63756d656e746174696f6e2f696d616765636f6c6f72616c6c6f6361746566726f6d737472696e672e61676a67642e6f72672f696d616765732f70617472656f6e2d62616467652e706e67)](https://patreon.com/agjopensource)

[![](https://camo.githubusercontent.com/27c8e5c32070d6022cf800430261e06149a8824dfa23b122df61f7b25c7bf05d/68747470733a2f2f696d616765636f6c6f72616c6c6f6361746566726f6d737472696e672e61676a67642e6f72672f646f63756d656e746174696f6e2f696d616765636f6c6f72616c6c6f6361746566726f6d737472696e672e61676a67642e6f72672f696d616765732f6176617461722e706e67)](https://imagecolorallocatefromstring.agjgd.org/)

Description
-----------

[](#description)

**imagecolorallocatefromstring** is a function that will allocate a color based on a string for your PHP GD images.

[![Patreon - Become a Patron](https://camo.githubusercontent.com/24c60c4550632628010d5c53c8cf9abc46d101caea3a76f057bff8884850c3b5/68747470733a2f2f7261737465722e736869656c64732e696f2f62616467652f50617472656f6e2532302d6265636f6d6525323061253230506174726f6e2d4644333334412e706e673f7374796c653d666f722d7468652d6261646765266c6f676f3d70617472656f6e266c6f676f436f6c6f723d464433333441)](https://patreon.com/agjopensource)

**imagecolorallocatefromstring** is an [agjgd](https://agjgd.org) project.

Usage
-----

[](#usage)

### With Composer

[](#with-composer)

This project offers support for the [Composer](https://getcomposer.org/) dependency manager. You can find the imagecolorallocatefromstring package online on [packagist.org](https://packagist.org/packages/andrewgjohnson/imagecolorallocatefromstring).

#### Install using Composer

[](#install-using-composer)

Either run this command:

```
composer require andrewgjohnson/imagecolorallocatefromstring

```

or add this to the `require` section of your composer.json file:

```
"andrewgjohnson/imagecolorallocatefromstring": "1.*"

```

### Without Composer

[](#without-composer)

To use without Composer add an [include](http://php.net/manual/function.include.php) to the [`imagecolorallocatefromstring.php` source file](https://raw.githubusercontent.com/andrewgjohnson/imagecolorallocatefromstring/master/source/imagecolorallocatefromstring.php).

```
include_once 'source/imagecolorallocatefromstring.php';

```

Examples
--------

[](#examples)

```
// standard method to allocate a color for an image
$red = imagecolorallocate($im, 0xFF, 0x00, 0x00);

// these will all allocate the same color as the method above
$alsoRed = imagecolorallocatefromstring($im, '#FF0000');
$alsoRed = imagecolorallocatefromstring($im, '#Ff0000');
$alsoRed = imagecolorallocatefromstring($im, '#ff0000');
$alsoRed = imagecolorallocatefromstring($im, '#f00');
$alsoRed = imagecolorallocatefromstring($im, 'f00');

```

There are [other examples](https://github.com/andrewgjohnson/imagecolorallocatefromstring/tree/master/examples) included in the GitHub repository and on [imagecolorallocatefromstring.agjgd.org](https://imagecolorallocatefromstring.agjgd.org/examples/).

Help Requests
-------------

[](#help-requests)

Please post any questions in the [discussions area](https://github.com/andrewgjohnson/imagecolorallocatefromstring/discussions) on GitHub if you need help.

If you discover a bug please [enter an issue](https://github.com/andrewgjohnson/imagecolorallocatefromstring/issues/new) on GitHub. When submitting an issue please use our [issue template](https://github.com/andrewgjohnson/imagecolorallocatefromstring/blob/master/ISSUE_TEMPLATE.md).

Contributing
------------

[](#contributing)

Please read our [contributing guidelines](https://github.com/andrewgjohnson/imagecolorallocatefromstring/blob/master/CONTRIBUTING.md) if you want to contribute.

You can contribute financially by becoming a [patron](https://patreon.com/agjopensource) at [patreon.com/agjopensource](https://patreon.com/agjopensource) to support imagecolorallocatefromstring and [other agjgd.org projects](https://agjgd.org/projects/).

[![Patreon - Become a Patron](https://camo.githubusercontent.com/24c60c4550632628010d5c53c8cf9abc46d101caea3a76f057bff8884850c3b5/68747470733a2f2f7261737465722e736869656c64732e696f2f62616467652f50617472656f6e2532302d6265636f6d6525323061253230506174726f6e2d4644333334412e706e673f7374796c653d666f722d7468652d6261646765266c6f676f3d70617472656f6e266c6f676f436f6c6f723d464433333441)](https://patreon.com/agjopensource)

Acknowledgements
----------------

[](#acknowledgements)

This project was started by [Andrew G. Johnson (@andrewgjohnson)](https://github.com/andrewgjohnson).

Full list of contributors:

- [Andrew G. Johnson (@andrewgjohnson)](https://github.com/andrewgjohnson)

Our [security policies and procedures](https://github.com/andrewgjohnson/imagecolorallocatefromstring/blob/master/.github/SECURITY.md) comes via the [atomist/samples](https://github.com/atomist/samples/blob/master/SECURITY.md) project. Our [issue templates](https://github.com/andrewgjohnson/imagecolorallocatefromstring/tree/master/.github/ISSUE_TEMPLATE) comes via the [tensorflow/tensorflow](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) project. Our [pull request template](https://github.com/andrewgjohnson/imagecolorallocatefromstring/blob/master/.github/PULL_REQUEST_TEMPLATE.md) comes via the [stevemao/github-issue-templates](https://github.com/stevemao/github-issue-templates) project. The [mountains photo](https://unsplash.com/photos/qJvpykJ5SKs) comes via [Gabriel Garcia Marengo](https://unsplash.com/@gabrielgm).

Changelog
---------

[](#changelog)

You can find all notable changes in the [changelog](https://github.com/andrewgjohnson/imagecolorallocatefromstring/blob/master/CHANGELOG.md).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance9

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.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 ~722 days

Total

3

Last Release

1263d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a2c654feaba88830ba4fd37496255b92c6404cb78f5e7d90186da1496141986?d=identicon)[andrewgjohnson](/maintainers/andrewgjohnson)

---

Top Contributors

[![andrewgjohnson](https://avatars.githubusercontent.com/u/1124501?v=4)](https://github.com/andrewgjohnson "andrewgjohnson (18 commits)")[![ImgBotApp](https://avatars.githubusercontent.com/u/31427850?v=4)](https://github.com/ImgBotApp "ImgBotApp (1 commits)")

---

Tags

composergdgraphicsimageimagesphpimagegdgraphicsimages

### Embed Badge

![Health badge](/badges/andrewgjohnson-imagecolorallocatefromstring/health.svg)

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

###  Alternatives

[intervention/image

PHP Image Processing

14.3k194.3M2.2k](/packages/intervention-image)[league/glide

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

2.6k51.2M116](/packages/league-glide)[gregwar/image

Image handling

1.0k4.1M51](/packages/gregwar-image)[rosell-dk/webp-convert

Convert JPEG &amp; PNG to WebP with PHP

6038.1M53](/packages/rosell-dk-webp-convert)[sybio/image-workshop

Powerful PHP class using GD library to work easily with images including layer notion (like Photoshop or GIMP)

860918.1k11](/packages/sybio-image-workshop)[andrewgjohnson/imagettftextblur

imagettftextblur is a drop in replacement for imagettftext with added parameters to add blur, glow and shadow effects to your PHP GD images

27198.4k1](/packages/andrewgjohnson-imagettftextblur)

PHPackages © 2026

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