Download the PHP package abderrahimghazali/color-palette-extractor without Composer

On this page you can find all versions of the php package abderrahimghazali/color-palette-extractor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package color-palette-extractor

Color Palette Extractor

A fast and simple PHP library to extract dominant colors from images using GD extension.

Features

Installation

Requirements:

Quick Start

Advanced Usage

Different Output Formats

Quality Control

Image Analysis

From Image Data

Method Reference

Core Methods

getDominant(int $count = 5, bool $excludeSimilar = true): array

Extract dominant colors from the image.

getPrimary(): string

Get the single most dominant color.

getPaletteWithPercentages(int $count = 5): array

Get colors with their percentage coverage.

getBrightness(): string

Determine if image is 'light' or 'dark'.

getComplementary(int $count = 5): array

Get complementary colors for the palette.

Configuration Methods

quality(int $quality): self

Set extraction quality (1-10, higher = more accurate but slower).

format(string $format): self

Set output format: 'hex', 'rgb', or 'hsl'.

Static Factory Methods

ColorPalette::fromImage(string $path): self

Create instance from image file path.

ColorPalette::fromData(string $data): self

Create instance from raw image data.

Real-World Examples

Website Theme Generator

Product Color Analysis

Automatic Color Tagging

Error Handling

Performance Tips

  1. Use quality control: Lower quality (1-3) for thumbnails, higher (7-10) for detailed analysis
  2. Process smaller images: The library automatically resizes, but smaller sources are faster
  3. Cache results: Color extraction is CPU-intensive, cache results when possible
  4. Exclude similar colors: Keep excludeSimilar=true for cleaner palettes

Supported Image Formats

How It Works

  1. Image Loading: Uses GD to load the image
  2. Resizing: Automatically resizes to ~150px for performance
  3. Color Sampling: Samples pixels based on quality setting
  4. Color Grouping: Groups similar colors to reduce noise
  5. Frequency Analysis: Counts color occurrences
  6. Filtering: Removes rare colors and optionally similar colors
  7. Formatting: Converts to requested output format

License

MIT License. See LICENSE file for details.

Contributing

Pull requests welcome! Please ensure tests pass:


All versions of color-palette-extractor with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-gd Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package abderrahimghazali/color-palette-extractor contains the following files

Loading the files please wait ...