Advertisement
SirBaconBitz

PNG to Hex

Apr 27th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. <?php
  2. $im = imagecreatefrompng("http://img2.wikia.nocookie.net/__cb20130530155332/cityville/images/3/30/Viral_hybridbuildingwizardtower_wizard_hat_64x64.png");
  3.  
  4. $colors = imagecolorsforindex($im, $rgb);
  5.  
  6. for ($y=0; $y<=64; $y++) {
  7.    for ($x=0; $x<=64; $x++) {
  8.    $rgb = imagecolorat($im,$x,$y);
  9.    $colors = imagecolorsforindex($im, $rgb);
  10.    echo dechex($colors["red"]).dechex($colors["green"]).dechex($colors["blue"])." ";
  11.    }
  12. echo "<br>";  
  13. }
  14.  
  15. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement