- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
<?php
$img = imagecreatefromgif('http://web.archive.org/web/20070419044913im_/upyachka.ru/img/kot/16.gif');
$w = imagesx($img);
$h = imagesy($img);
$symbols = array(' ', '▀', '▄', '█');
for($y = 0; $y < floor($w/2); ++$y) {
for($x = 0; $x < $w; ++$x) {
$color1 = imagecolorat($img, $x, 2*$y);
$color2 = imagecolorat($img, $x, 2*$y+1);
$bit1 = intval(($color1 & 0xff) > 0x80);
$bit2 = intval(($color2 & 0xff) > 0x80);
echo $symbols[$bit1 + ($bit2 << 1)];
}
echo PHP_EOL;
}