Skip to content

This library converts a given image to ASCII string

License

Notifications You must be signed in to change notification settings

ixnode/php-cli-image

Repository files navigation

PHP Cli Image

Release PHP PHPStan PHPUnit PHPCS PHPMD Rector - Instant Upgrades and Automated Refactoring LICENSE

This library prints a given image to cli as ascii string.

1. Usage

use Ixnode\PhpCliImage\CliImage;

1.1 Simple example

$file = new File('path/to/image');
$width = 80;
$image = new CliImage($file);

print $image->getAsciiString($width);

2. Installation

composer require ixnode/php-cli-image
vendor/bin/php-cli-image -V
php-cli-image 0.1.0 (03-07-2023 01:17:26) - Björn Hempel <bjoern@hempel.li>

3. Command line tool

Used to quickly check the image output of given image.

bin/console ci docs/image/world-map.png

or within your composer project:

vendor/bin/php-cli-image ci vendor/ixnode/php-cli-image/docs/image/world-map.png
                     ▄▄▄▄▀▄▄▄▄▄▄▄▄▄▄
       ▄▄    ▄▄▄▄▄▄▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀                ▄▄▄▄▀▀▀▀▀▄▄▄▄▄▄▄▄▄▄
  ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀      ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀   ▀▀          ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
       ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀           ▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄ ▀▀
     ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀            ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀               ▀▀▀▀▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄
     ▀▀▀▀▀▀▀▀▀▀▀▀                 ▀▀▀▀▀▀▀▀▀▀▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
      ▀▀▀▀▀▀▄▄ ▀                ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
        ▀▀▀▀▀▀                  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀▀▀▀▀
           ▀▀▀▄▄▀▀▄▄▄           ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀      ▀▀    ▀▀▀▀
              ▀▀▀▀▀▀▀▀▀▄         ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀            ▀▄  ▄▀▀
              ▀▀▀▀▀▀▀▀▀▀▀▄▄▄           ▀▀▀▀▀▀▀▀▀▀▀              ▀▀▀▀▀▀▀   ▀▄▄▄▄
              ▀▀▀▀▀▀▀▀▀▀▀▀▀▀            ▀▀▀▀▀▀▀▀▀                 ▀        ▀▀▀▀▄
               ▀▀▀▀▀▀▀▀▀▀▀▀             ▀▀▀▀▀▀▀▀▀▄▀▀                   ▄▀▀▀▀▀▀
                  ▀▀▀▀▀▀▀▀▀             ▀▀▀▀▀▀▀▀ ▀▀                 ▀▀▀▀▀▀▀▀▀▀▀
                  ▀▀▀▀▀▀▀                ▀▀▀▀▀▀  ▀                  ▀▀▀▀▀▀▀▀▀▀▀
                  ▀▀▀▀▀▀                  ▀▀▀                       ▀▀▀▀▀▀▀▀▀▀▀
                  ▀▀▀▀                                                     ▀
                   ▀▀▀

Services

4. Library development

git clone git@github.com:ixnode/php-cli-image.git && cd php-cli-image
composer install
composer test

5. License

This library is licensed under the MIT License - see the LICENSE file for details.