katuscak/fontcolorbyimage

Get contrast font color based on image

dev-master 2014-09-12 14:26 UTC

This package is auto-updated.

Last update: 2024-02-29 03:23:22 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
 * )
 */