pixelmap.php 388 B

1234567891011121314151617181920
  1. <?php
  2. require_once 'bootstrap.php';
  3. //$pixelCraft=new PixelCraft();
  4. $pixelCraft->loadImage('../assets/bw_smile.png');
  5. $pixelMap='';
  6. $colorMap=$pixelCraft->getColorMap(false);
  7. foreach ($colorMap as $y=>$xs) {
  8. foreach ($xs as $color) {
  9. $dot = ($color['r'] AND $color['g'] AND $color['b']) ? 1 : 0;
  10. $pixelMap.=$dot;
  11. }
  12. $pixelMap.=PHP_EOL;
  13. }
  14. print($pixelMap);