Change colour similarity metric
[pixel-calc.git] / public_html / upload.php
index cf1e765..1baa758 100644 (file)
@@ -126,7 +126,7 @@ if(isset($_POST["submit"])) {
         $green2 = hexdec(substr($rgb2,2,2));
         $blue2  = hexdec(substr($rgb2,4,2));
 
-        return abs($red1 - $red2) + abs($green1 - $green2) + abs($blue1 - $blue2) ;
+        return sqrt(pow($red1 - $red2, 2) + pow($green1 - $green2, 2) + pow($blue1 - $blue2, 2)) ;
     }
     
     function closest_colour($rgb, array $colours) {