PHPackages                             vitorbari/image-to-color-palette - 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. vitorbari/image-to-color-palette

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

vitorbari/image-to-color-palette
================================

A PHP class that generates color palettes from images

1.0.2(10y ago)134MITPHPPHP &gt;=5.3.0

Since Aug 22Pushed 9y ago1 watchersCompare

[ Source](https://github.com/vitorbari/image-to-color-palette)[ Packagist](https://packagist.org/packages/vitorbari/image-to-color-palette)[ RSS](/packages/vitorbari-image-to-color-palette/feed)WikiDiscussions master Synced today

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

image-to-color-palette
======================

[](#image-to-color-palette)

[![Build Status](https://camo.githubusercontent.com/fb5be6d4266ca16a2fda608d81b1c4b5f732d46cff89903b48e70f94de3e94ce/68747470733a2f2f7472617669732d63692e6f72672f7669746f72626172692f696d6167652d746f2d636f6c6f722d70616c657474652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/vitorbari/image-to-color-palette)[![StyleCI](https://camo.githubusercontent.com/c29906e6c7af0ded8cc0beab6e8e45326f60ede4e397b219f896fdcd2fa10062/68747470733a2f2f7374796c6563692e696f2f7265706f732f31313337353836382f736869656c64)](https://styleci.io/repos/11375868)

A PHP class that generates color palettes from images.

Requirements
------------

[](#requirements)

- GD Library

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

[](#installation)

First, pull in the package through Composer.

```
"require": {
    "vitorbari/image-to-color-palette": "~1.0"
}
```

Usage
-----

[](#usage)

```
// Create new ColorPalette object
$palette = new VitorBari\ImageToColorPalette\ColorPalette();

// Set image
$palette->set_image_file('images/myimg.jpg');

// Get colors
$colors = $palette->get_palette();

// Print colors
echo "";
print_r($colors);
```

Examples
--------

[](#examples)

[![Example 1](examples/images/random.jpg?raw=true)](examples/images/random.jpg?raw=true)

Result:

```
Array
(
    [0] => #FF00CC
    [1] => #00FF99
    [2] => #00FF66
    [3] => #00FFCC
    [4] => #99FF00
)

```

[![Example 1 result](examples/images/random-result.png?raw=true)](examples/images/random-result.png?raw=true)

[![Example 2](examples/images/php-med-trans.png?raw=true)](examples/images/php-med-trans.png?raw=true)

Result:

```
Array
(
    [0] => #6666CC
    [1] => #FFFFFF
    [2] => #000000
    [3] => #666699
    [4] => #666666
)

```

[![Example 2 result](examples/images/php-result.png?raw=true)](examples/images/php-result.png?raw=true)

[![Example 3](examples/images/mountains.jpg?raw=true)](examples/images/mountains.jpg?raw=true)

Result:

```
Array
(
    [0] => #0066CC
    [1] => #003366
    [2] => #CCCCCC
    [3] => #336633
    [4] => #006699
)

```

[![Example 3 result](examples/images/mountains-result.png?raw=true)](examples/images/mountains-result.png?raw=true)

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

3968d ago

PHP version history (2 changes)1.0PHP &gt;=5.2.0

1.0.1PHP &gt;=5.3.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1184252?v=4)[Vitor Bari Buccianti](/maintainers/vitorbari)[@vitorbari](https://github.com/vitorbari)

---

Top Contributors

[![vitorbari](https://avatars.githubusercontent.com/u/1184252?v=4)](https://github.com/vitorbari "vitorbari (14 commits)")

---

Tags

color-palettephp

### Embed Badge

![Health badge](/badges/vitorbari-image-to-color-palette/health.svg)

```
[![Health](https://phpackages.com/badges/vitorbari-image-to-color-palette/health.svg)](https://phpackages.com/packages/vitorbari-image-to-color-palette)
```

###  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)
