Download the PHP package ksubileau/color-thief-php without Composer

On this page you can find all versions of the php package ksubileau/color-thief-php. 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?
ksubileau/color-thief-php
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package color-thief-php

Color Thief PHP

Latest Stable Version Build Status GitHub issues Packagist License

A PHP class for grabbing the color palette from an image. Uses PHP and GD, Imagick or Gmagick libraries to make it happen.

It's a PHP port of the Color Thief Javascript library, using the MMCQ (modified median cut quantization) algorithm from the Leptonica library.

See examples

Requirements

How to use

Install via Composer

The recommended way to install Color Thief is through Composer:

Get the dominant color from an image

The $sourceImage variable must contain either the absolute path of the image on the server, a URL to the image, a GD resource containing the image, an Imagick image instance, a Gmagick image instance, or an image in binary string format.

You can pass an additional argument ($quality) to adjust the calculation accuracy of the dominant color. 1 is the highest quality settings, 10 is the default. But be aware that there is a trade-off between quality and speed/memory consumption ! If the quality settings are too high (close to 1) relative to the image size (pixel counts), it may exceed the memory limit set in the PHP configuration (and computation will be slow).

You can also pass another additional argument ($area) to specify a rectangular area in the image in order to get dominant colors only inside this area. This argument must be an associative array with the following keys :

By default, color is returned as an array of three integers representing red, green, and blue values. You can choose another output format by passing one of the following values to the $outputFormat argument :

The optional $adapter argument lets you choose a preferred image adapter to use to load the image. By default, the adapter is automatically chosen based on the available extensions and the type of $sourceImage (e.g. Imagick is used if $sourceImage is an Imagick instance). You can pass one of the Imagick, Gmagick or Gd string to force the use of the corresponding underlying image extension. For advanced usage, you can even pass an instance of any class implementing the AdapterInterface interface to use a custom image loader.

Build a color palette from an image

In this example, we build an 8 color palette.

Again, the $sourceImage variable must contain either the absolute path of the image on the server, a URL to the image, a GD resource containing the image, an Imagick image instance, a Gmagick image instance, or an image in binary string format.

The $colorCount argument determines the size of the palette; the number of colors returned. If not set, it defaults to 10.

The $quality, $area, $outputFormat and $adapter arguments work as in the previous function.

Credits

Author

by Kevin Subileau kevinsubileau.fr

Based on the fabulous work done by Lokesh Dhakar lokeshdhakar.com twitter.com/lokesh

Thanks


All versions of color-thief-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
ext-fileinfo 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 ksubileau/color-thief-php contains the following files

Loading the files please wait ....