From f11d9d82acc9ff8bc6eec178ad2527ee89462793 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Thu, 12 Jan 2012 03:14:58 +0100 Subject: properly round color components --- index.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 4fff92d..889d91d 100644 --- a/index.php +++ b/index.php @@ -174,9 +174,10 @@ function extract_dominant_color($svg, $algo = 'average', $filter = 'grey') function clip_color_value($c) { - if ($c < 0) return 0; - else if ($c > 255) return 255; - return $c; + $i = intval(round($c)); + if ($i < 0) return 0; + else if ($i > 255) return 255; + return $i; } function clip_color($c) -- cgit v1.2.3