Skip to content

Commit

Permalink
image data extraction demo
Browse files Browse the repository at this point in the history
  • Loading branch information
nightflyza committed Jan 9, 2024
1 parent 934674a commit f77e2f9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Binary file added assets/bw_smile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions examples/pixelmap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

require_once 'bootstrap.php';

//$pixelCraft=new PixelCraft();

$pixelCraft->loadImage('../assets/bw_smile.png');

$pixelMap='';
$colorMap=$pixelCraft->getColorMap(false);

foreach ($colorMap as $y=>$xs) {
foreach ($xs as $color) {
$dot = ($color['r'] AND $color['g'] AND $color['b']) ? 1 : 0;
$pixelMap.=$dot;
}
$pixelMap.=PHP_EOL;
}

print($pixelMap);

0 comments on commit f77e2f9

Please sign in to comment.