https://github.com/ixnode/php-cli-image
This library converts a given image to ASCII string
https://github.com/ixnode/php-cli-image
Last synced: 3 months ago
JSON representation
This library converts a given image to ASCII string
- Host: GitHub
- URL: https://github.com/ixnode/php-cli-image
- Owner: ixnode
- License: mit
- Created: 2023-08-13T23:15:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-07T11:52:01.000Z (7 months ago)
- Last Synced: 2024-12-08T09:07:23.412Z (7 months ago)
- Language: PHP
- Size: 108 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP Cli Image
[](https://github.com/ixnode/php-cli-image/releases)
[](https://github.com/ixnode/php-cli-image/releases)

[](https://www.php.net/supported-versions.php)
[](https://phpstan.org/user-guide/rule-levels)
[](https://phpunit.de)
[](https://www.php-fig.org/psr/psr-12/)
[](https://github.com/phpmd/phpmd)
[](https://github.com/rectorphp/rector)
[](https://github.com/ixnode/php-api-version-bundle/blob/master/LICENSE)> This library prints a given image to cli as ascii string.
## 1. Usage
```php
use Ixnode\PhpCliImage\CliImage;
```### 1.1 Simple example
```php
$file = new File('path/to/image');
$width = 80;
$image = new CliImage($file);print $image->getAsciiString($width);
```## 2. Installation
```bash
composer require ixnode/php-cli-image
``````bash
vendor/bin/php-cli-image -V
``````bash
php-cli-image 0.1.0 (03-07-2023 01:17:26) - Björn Hempel
```## 3. Command line tool
> Used to quickly check the image output of given image.
```bash
bin/console ci docs/image/world-map.png --engine=gd-image --width=80
```or within your composer project:
```bash
vendor/bin/php-cli-image ci vendor/ixnode/php-cli-image/docs/image/world-map.png
``````bash
▄▄▄▄▀▄▄▄▄▄▄▄▄▄▄
▄▄ ▄▄▄▄▄▄▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▄▄▄▄▀▀▀▀▀▄▄▄▄▄▄▄▄▄▄
▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄ ▀▀
▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄
▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
▀▀▀▀▀▀▄▄ ▀ ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀
▀▀▀▄▄▀▀▄▄▄ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀ ▀▀▀▀
▀▀▀▀▀▀▀▀▀▄ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▄ ▄▀▀
▀▀▀▀▀▀▀▀▀▀▀▄▄▄ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀ ▀▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀ ▀ ▀▀▀▀▄
▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▄▀▀ ▄▀▀▀▀▀▀
▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀ ▀▀ ▀▀▀▀▀▀▀▀▀▀▀
▀▀▀▀▀▀▀ ▀▀▀▀▀▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀
▀▀▀▀▀▀ ▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀
▀▀▀▀ ▀
▀▀▀
```
## 4. Library development
```bash
git clone [email protected]:ixnode/php-cli-image.git && cd php-cli-image
``````bash
composer install
``````bash
composer test
```## 5. License
This library is licensed under the MIT License - see the [LICENSE](/LICENSE) file for details.