{"id":13519760,"url":"https://github.com/lastguest/pixeler","last_synced_at":"2026-01-10T12:18:22.350Z","repository":{"id":21125441,"uuid":"24426307","full_name":"lastguest/pixeler","owner":"lastguest","description":"CLI image renderer","archived":false,"fork":false,"pushed_at":"2018-09-06T10:07:07.000Z","size":31,"stargazers_count":452,"open_issues_count":0,"forks_count":18,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-18T07:11:14.372Z","etag":null,"topics":["cli","php","pixel-art"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lastguest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-24T17:59:07.000Z","updated_at":"2025-02-05T18:27:54.000Z","dependencies_parsed_at":"2022-08-21T15:10:37.986Z","dependency_job_id":null,"html_url":"https://github.com/lastguest/pixeler","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lastguest%2Fpixeler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lastguest%2Fpixeler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lastguest%2Fpixeler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lastguest%2Fpixeler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lastguest","download_url":"https://codeload.github.com/lastguest/pixeler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246482951,"owners_count":20784801,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","php","pixel-art"],"created_at":"2024-08-01T05:02:02.858Z","updated_at":"2026-01-10T12:18:22.301Z","avatar_url":"https://github.com/lastguest.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Pixeler\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/lastguest/pixeler?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nRender images in CLI with UTF-8 characters.\n\n\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/lastguest/pixeler/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/lastguest/pixeler/?branch=master)\n[![Total Downloads](https://poser.pugx.org/lastguest/pixeler/downloads.svg)](https://packagist.org/packages/lastguest/pixeler)\n[![Latest Stable Version](https://poser.pugx.org/lastguest/pixeler/v/stable.svg)](https://packagist.org/packages/lastguest/pixeler)\n[![Latest Unstable Version](https://poser.pugx.org/lastguest/pixeler/v/unstable.svg)](https://packagist.org/packages/lastguest/pixeler)\n[![License](https://poser.pugx.org/lastguest/pixeler/license.svg)](https://packagist.org/packages/lastguest/pixeler)\n\n\u003cimg src=\"http://f.cl.ly/items/3P212W0G0S0m0s1d3w1r/code.gif\" width=\"700\" /\u003e\n\n## Installation\n\nRequire in your project with [composer](https://getcomposer.org/download/) :\n\n```bash\n$ composer require lastguest/pixeler\n```\n\nThis will also install a **pixeler** tool in : \n\n```\nyour_project_dir/vendor/bin/pixeler\n```\n\nIt works exactly like the example below.\n\n\n### Example \n\nCreate a file `pixel.php` :\n\n```php\n\u003c?php\n\n// Include autoloader\ninclude __DIR__.\"/vendor/autoload.php\";\n\n// Parse options from command line\n$opts = array_merge([\n    'd' =\u003e 1,    // Dithering mode : 0 = DITHER_NONE, 1 = DITHER_ERROR\n    'f' =\u003e false,\n    'r' =\u003e 1.0,  // Resize factor 1.0 = 100%\n    'w' =\u003e 0.75, // Dither treshold weight\n], getopt(\"f:r:w:d:ib\"));\n\n// An image file/url is required.\n$opts['f'] || die(\"Must specify an image file.\\n\");\n\n// The -i option inverts the image\n$image = Pixeler\\Pixeler::image($opts['f'], $opts['r'], isset($opts['i']), $opts['w'], $opts['d']);\n\n// No colors if \"-b\" is passed\nisset($opts['b']) \u0026\u0026 $image-\u003eclearColors();\n\n// The Pixeler\\Image instance render itself if casted to a string\necho $image;\n```\n\n\n```bash\n$ php pixel.php -f http://drop.caffeina.co/image/160L0Y3C0a29/vocaloid.jpg -r .25 -w 0.25 -i\n```\n\n\u003cimg src=\"http://drop.caffeina.co/image/1B133A0N3V0c/vocal.png\" width=\"700\" /\u003e\n\n```bash\n$ php pixel.php -f http://flippywall.com/wp-content/uploads/2014/07/Manga-Girl-Wallpaper-16.jpg -r 0.15 -w 0.5 -i\n```\n\n\u003cimg src=\"http://drop.caffeina.co/image/471V2N1J1R1r/pixlr-color.png\" width=\"700\" /\u003e\n\n```bash\n$ php pixel.php -f http://blog.circleci.com/wp-content/uploads/2014/07/elephant.jpg -r 0.3 -w 0.5 -b\n```\n\n\u003cimg src=\"http://cl.ly/image/1W2B0i2X3f01/pixeler_demo.png\" width=\"700\" /\u003e\n\n### Dithering\n\nUse the `-d` option to choose 1-bit dithering mode.\n\nCommand | Constant | Description\n----|------|----\n`-d0` | Pixeler\\Image::DITHER_NONE | Threshold 1-bit quantization\n`-d1` | Pixeler\\Image::DITHER_ERROR | Dither image with 1-bit Atkinson Dithering\n\n### Animation Example\n\nYou will see a lot of tearing, need some kind of vsync wait.\n\n```php\n\u003c?php\n\n// Vendors\ninclude __DIR__.\"/vendor/autoload.php\";\n\n$screen = new Pixeler\\Canvas(160,100);\n$sh2 = $screen-\u003eheight()/2;\n$sh4 = $sh2/1.5;\n$ph = pi()/32;\n$i = 0;\n\n// To exit, press Ctr-C\nwhile(1){\n  $screen-\u003eclear();\n  for ($x=0,$c=$screen-\u003ewidth(); $x \u003c $c; $x++){\n    $y = $sh4*sin($i++/128 + $ph*$x);\n    $screen-\u003esetPixel($x,$sh2 + $y);\n    $screen-\u003esetPixel($x,$sh2 + $y/2);\n    $screen-\u003esetPixel($x,$sh2 + $y/4);\n    $screen-\u003esetPixel($x,$sh2);\n  }\n  echo $screen;\n}\n```\n\n\u003cimg src=\"http://f.cl.ly/items/3P212W0G0S0m0s1d3w1r/code.gif\" width=\"700\" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flastguest%2Fpixeler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flastguest%2Fpixeler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flastguest%2Fpixeler/lists"}