V
V
Vlad Lisovets2018-09-18 23:48:51
css
Vlad Lisovets, 2018-09-18 23:48:51

Set a gradient over an image with the dominant color of this image?

Hello! Orient please, ran into a dead end, I can not figure out the solution.
There is a task:
There is a block with a background image and text inside this block. We need to create a gradient fill below the text so that the color of this gradient is the same as the dominant color in the background image. This is already on the Yandex Zen website. All blocks are designed this way. Can you please tell me if this can be solved with php? What library should be used to select the dominant color from the background image on the go and pass it to css, from which the text block takes the color to itself on a gradient background?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2018-09-19
@andreybold

If on the selection of a color palette, then there is such an article.
To implement this algorithm in php, I used ImageMagick (maybe this is from the “from a cannon to sparrows” series and you can get by with the same GD, but it was somehow more familiar and faster to me)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question