Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. function mkimgsig($image, $sx, $sy)
  2. {
  3. $rgbs = array(0, 0, 0);
  4. for ($x = 0; $x < $sx; $x++)
  5. {
  6. for ($y = 0; $y < $sy; $y++)
  7. {
  8. $rgb = imagecolorat($image, $x, $y);
  9. // Na 3 palete... red green blue
  10. #echo "$x:$y $relpos {$rgbs[0]} {$rgbs[1]} {$rgbs[2]} \r";
  11. $rgbs[0] += (($rgb >> 16) & 0xFF);
  12. $rgbs[1] += (($rgb >> 8) & 0xFF);
  13. $rgbs[2] += ($rgb & 0xFF);
  14. }
  15. }
  16. $maxnums = $sx*$sy*255;
  17. $rgbs = array($rgbs[0] / $maxnums, $rgbs[1] / $maxnums, $rgbs[2] / $maxnums);
  18. return $rgbs;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement