ksubileau / color-thief-php

Grabs the dominant color or a representative color palette from an image. Uses PHP and GD, Imagick or Gmagick.
MIT License
632 stars 65 forks source link

Why disregarding bright colors? #54

Open skripnik opened 2 years ago

skripnik commented 2 years ago

Current implementation disregards all the colors that are rgb(250, 250, 250) or brighter (see THRESHOLD_WHITE variable).

This can be useful for some users. Let's say you want to get a dominant color of a dress for an online shop and all the pictures are on white background.

But why this is default behaviour? Why this can't be changed? Why there's nothing about it in the description?

I wish by default all the bright colors also would be considered by algorithm, but user can explicitly add a parameter like $threshhold_white to exclude them.

ksubileau commented 1 year ago

This library is originally a port of the Javascript library of the same name, with the primary intention to have the same API, (almost) the same result, and the same features. This behavior is therefore inherited from this JavaScript library, which also does not provide a way to disable it.

However, since the original library does not evolve very much, I've added some additional features in the last few versions, and this could perhaps be added in a future one.

araeubig commented 3 months ago

This would really be great if you could add this. By analyzing photographies and black/white photographies too, i couldn't have the "white" colors in the palette.

Perhaps it would be great to get a possibility to overwrite this at the moment.