Download the PHP package ckdot/product-image-color-extractor without Composer
On this page you can find all versions of the php package ckdot/product-image-color-extractor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ckdot/product-image-color-extractor
More information about ckdot/product-image-color-extractor
Files in ckdot/product-image-color-extractor
Package product-image-color-extractor
Short Description ckdot/product-image-color-extractor is a PHP library for extracting colors from product images like they are common in E-Commerce.
License MIT
Informations about the package product-image-color-extractor
kilb/product-image-color-extractor
kilb/product-image-color-extractor is a PHP library for extracting colors from product images like they are common in E-Commerce.
Installation
ImageMagick and PHP Imagick Module are required.
About
I've implemented this piece of software to find out what colors product images I imported from several APIs have. There were just two requirements I had:
-
The result (colors) should be quite accurate
- The execution should be fast - so thousands of images must be processed after a few minutes
The following steps will be done to find out the color of an image:
-
Top part of the image will be cropped. When I compared a lot of E-commerce images I found out that in most cases the content in top part is not that important like other parts (head of a person etc.)
-
Resize image to a lower size. This will improve speed the speed of the following tasks.
-
Reduce colors in image. This will make sure similar colors will be equalized and just a bunch of different colors will be returned.
-
Remove background of the image. This will make sure, the most frequent color returned won't be white when the background color of the image is white.
-
Iterate every pixel in the image. Every pixel will get a score. The score will be higher if the pixel is close to the center of the image. The score will be lower, if the pixel is a) closer to the image border or b) the color of the pixel has a skin tone. Score will be summed up for every different color.
- Score for every color will be calculated into relative %, colors will be returned by score - highest first.
Usage