Nel tutorial di oggi imparerete come trovare il colore dominante di un'immagine con PHP.
Questo tutorial potrebbe tornarvi utile ad esempio, se desiderate raggruppare le immagini per colore.
$i = imagecreatefromjpeg("image.jpg"); for ($x=0;$x<imagesx ($i);$x++) { for ($y=0;$y<imagesy($i);$y++) { $rgb = imagecolorat($i,$x,$y); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> & 0xFF; $b = $rgb & 0xFF; $rTotal += $r; $gTotal += $g; $bTotal += $b; $total++; } } $rAverage = round($rTotal/$total); $gAverage = round($gTotal/$total); $bAverage = round($bTotal/$total); </imagesx>



Leave Your Response