<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_66221"> <div class="blockcode"> <div id="code_cX0"><ol> <li>function dominant_color($image)</li> <li>{</li> <li>$i = imagecreatefromjpeg($image);</li> <li>for ($x=0;$x<imagesx($i);$x ) {<li> for ($y=0;$y<imagesy($i);$y ) {<li> $rgb = imagecolorat($i,$x,$y);<li> $r = ($rgb >> 16) & 0xFF;</li> <li> $g = ($rgb >> & 0xFF;</li> <li> $b = $rgb & 0xFF;</li> <li> $rTotal = $r;</li> <li> $gTotal = $g;</li> <li> $bTotal = $b;</li> <li> $total ;</li> <li> }</li> <li>}</li> <li>$rAverage = round($rTotal/$total);</li> <li>$gAverage = round($gTotal/$total);</li> <li>$bAverage = round($bTotal/$total);</li> <li>}</li> </ol></div> <em onclick="copycode($('code_cX0'));">复制代码</em> </div> <br> </td></tr></table> <div class="ptg mbm mtn"> PHP</div> <div id="comment_66221" class="cm"> </div> <div id="post_rate_div_66221"></div> <br><br>