katuscak / fontcolorbyimage
Get contrast font color based on image
dev-master
2014-09-12 14:26 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-08-29 04:42:41 UTC
README
Get contrast font color based on image in PHP
Using:
<?php require "FontColorByImage.class.php"; $url = "http://yousize.com/yourimage.png"; $fontColor = (new \Katuscak\FontColorByImage($url))->get(); print_r($fontColor); /* * Array ( * [r] => 160, * [g] => 123, * [b] => 255 * ) */
Composer install
composer require katuscak/fontcolorbyimage dev-master
Using with Composer
Class will be loaded automatically with all others which have installed over Composer.
<?php require 'vendor/autoload.php'; $url = "http://yousize.com/yourimage.png"; $fontColor = (new \Katuscak\FontColorByImage($url))->get(); print_r($fontColor); /* * Array ( * [r] => 160, * [g] => 123, * [b] => 255 * ) */