Created
July 13, 2016 12:52
-
-
Save yoya/3370e1e96fcd7b6083d90a7ab12606f3 to your computer and use it in GitHub Desktop.
RGB444 の色を全部使うだけの画像
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set("memory_limit", '2G'); | |
$nPixels = pow(2, 4 + 4 + 4); | |
$width = (int) sqrt($nPixels); | |
$height = $nPixels /$width; | |
$im = imagecreatetruecolor($width, $height); | |
if (! $im) { | |
echo "im is false"; | |
exit (1); | |
} | |
$x = 0; | |
$y = 0; | |
for ($r = 0 ; $r < 0x100 ; $r+=0x11) { | |
// echo "r:$r\n"; | |
for ($g = 0 ; $g < 0x100 ; $g+=0x11) { | |
// echo "g:$g\n"; | |
for ($b = 0 ; $b < 0x100 ; $b+=0x11) { | |
// echo "b:$b\n"; | |
$c = imagecolorallocate($im, $r, $g, $b); | |
imagesetpixel($im, $x, $y, $c); | |
$x++; | |
if ($width <= $x) { | |
$x = 0; | |
$y++; | |
} | |
} | |
} | |
} | |
imagepng($im); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment