Creates a data-uri based on the image dominant color.
ImageMagick extension should be present.
require './vendor/autoload.php'; $image_url = 'https://www.elephantnaturepark.org/wp-content/uploads/2016/06/Lek_20may2016_01_n.jpg'; $i = new ImageColor\ImageColor($image_url); echo $i->get_data_uri();
info at phpclasses dot org