PHPackages                             fahmiardi/colors-of-image - 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. fahmiardi/colors-of-image

ActiveLibrary

fahmiardi/colors-of-image
=========================

Color utility class for PHP 5.3 that allows for easy conversion between RGB, HSV, XYZ, and Lab colorspaces, as well as color comparison

010PHP

Since Jun 28Pushed 11y ago1 watchersCompare

[ Source](https://github.com/fahmiardi/Colors-Of-Image)[ Packagist](https://packagist.org/packages/fahmiardi/colors-of-image)[ RSS](/packages/fahmiardi-colors-of-image/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Colors-Of-Image
===============

[](#colors-of-image)

Color of Image is used to extract a color palette from a given image. Aside from being a native PHP implementation, Color of Image differes from many palette extracters as it works off a white list color palette. Below is the default palette:

[![](https://camo.githubusercontent.com/d889de3e83fdef5ce757545a62ff8fb5ef4015d416ef1f3582b84e06c7167c29/68747470733a2f2f646c2e64726f70626f782e636f6d2f752f3233383530322f43617074757265642f52556635342e706e67)](https://camo.githubusercontent.com/d889de3e83fdef5ce757545a62ff8fb5ef4015d416ef1f3582b84e06c7167c29/68747470733a2f2f646c2e64726f70626f782e636f6d2f752f3233383530322f43617074757265642f52556635342e706e67)

The main advanage of working from a color palette is closer matching, as each pixel simply has to calculate the color-distance within the palatte and chose the best match. This is useful for working with color taxonomies as the taxonomy should have a finate amount of colors.

[![](https://camo.githubusercontent.com/536fc91bdfcebeb2100aa03d47df3715d5947d12fe2e3043b0a59f67f8eae179/68747470733a2f2f646c2e64726f70626f782e636f6d2f752f3233383530322f43617074757265642f48706856772e706e67)](https://camo.githubusercontent.com/536fc91bdfcebeb2100aa03d47df3715d5947d12fe2e3043b0a59f67f8eae179/68747470733a2f2f646c2e64726f70626f782e636f6d2f752f3233383530322f43617074757265642f48706856772e706e67)

See an example of this in action here:

Usage

---

```
// initiate with image
$image = new ColorsOfImage( 'https://www.google.co.uk/images/srpr/logo3w.png' );

// get the prominent colors
$colors = $image->getProminentColors(); // array( '#FFFDD', ... )
```

And there we go!

Options

---

**Precision**

By default, `ColorsOfImage` will process every 10th pixel. This is for performance reasons, you can change this like below. The precision is a performance-to-time desicion.

```
$image = new ColorsOfImage( $src, 5 /* precision */ );
```

**Color Count**

To control the amount colors returned set the third parameter.

```
$image = new ColorsOfImage( $src, 5, 3 /* number of colors to return */ );
```

Contribution guidelines
-----------------------

[](#contribution-guidelines)

see

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 64.3% 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/3264535342f6dd2bacce6425cb96c32d6113e25e3adac91a11660be332e764eb?d=identicon)[fahmiardi](/maintainers/fahmiardi)

---

Top Contributors

[![joehoyle](https://avatars.githubusercontent.com/u/161683?v=4)](https://github.com/joehoyle "joehoyle (18 commits)")[![fahmiardi](https://avatars.githubusercontent.com/u/1201482?v=4)](https://github.com/fahmiardi "fahmiardi (5 commits)")[![richardswain](https://avatars.githubusercontent.com/u/888319?v=4)](https://github.com/richardswain "richardswain (2 commits)")[![bhavyanshu](https://avatars.githubusercontent.com/u/3829459?v=4)](https://github.com/bhavyanshu "bhavyanshu (1 commits)")[![thenew](https://avatars.githubusercontent.com/u/772317?v=4)](https://github.com/thenew "thenew (1 commits)")[![willmot](https://avatars.githubusercontent.com/u/308507?v=4)](https://github.com/willmot "willmot (1 commits)")

### Embed Badge

![Health badge](/badges/fahmiardi-colors-of-image/health.svg)

```
[![Health](https://phpackages.com/badges/fahmiardi-colors-of-image/health.svg)](https://phpackages.com/packages/fahmiardi-colors-of-image)
```

PHPackages © 2026

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