获取图片主要颜色

为什么80%的码农都做不了架构师?>>>   hot3.png

> 16;
            $g += $rgb >> 8 & 255;
            $b += $rgb & 255;
        }
    }
    $pxls = $w * $h;
    $r = dechex(round($r / $pxls));
    $g = dechex(round($g / $pxls));
    $b = dechex(round($b / $pxls));
    if(strlen($r) < 2)$r = 0 . $r;
    if(strlen($g) < 2)$g = 0 . $g;
    if(strlen($b) < 2)$b = 0 . $b;
    return "#" . $r . $g . $b;
}
$color=get_image_color("color2.jpg");
echo "
";

转载于:https://my.oschina.net/yecao/blog/174310

你可能感兴趣的:(获取图片主要颜色)