alebcay /
awesome-shell
A curated list of awesome command-line frameworks, toolkits, guides and gizmos. Inspired by awesome-php.
Loading repository data…
AshleyJSheridan / repository
Command line PHP script to generate an image using CSS `box-shadow` with only a single `div`
Simple PHP CLI script to turn a JPEG image into a single div masterpiece using box-shadow to generate pixels.
composer install within the project root directorypixel_art file executableTo use, run the following in the command line:
./pixel_art path_to_jpeg_file.jpg
An HTML file with the same name but an .html extension will be generated within the dist directory. Open in any modern browser.
You can change the size of the CSS pixel blocks by changing the $css_block_size value. The script will read every $image_block_sizeth pixel from the image. Lowering this number will result in slower generation times and more box shadows.
This is the original (resized) image:
![]()
Using a 20:1 pixel ratio by setting image and pixel box size to 20, using a total of 468 box shadows:
![]()
More box shadows using a 10:1 ratio. Total box shadows is 1,820!
![]()
Finally, a 1:1 pixel ratio, resulting in a whopping 177,675 box shadows!:
![]()
Note, the examples here are screen shots taken from the resulting HTML page, as that kind of CSS isn't possible here.
Due to some browsers not handling too many box shadows on a single element, be careful when using either very large images, or very small pixel settings as your browser may not cope well.
This is only a very simple script with no error handling or any other nice things that you would expect. Things I'll be adding are:
Selected from shared topics, language and repository description—not editorial ratings.
alebcay /
A curated list of awesome command-line frameworks, toolkits, guides and gizmos. Inspired by awesome-php.
symfony /
Eases the creation of beautiful and testable command line interfaces
nunomaduro /
💥 Collision is a beautiful error reporting tool for command-line applications
ambionics /
PHPGGC is a library of PHP unserialize() payloads along with a tool to generate them, from command line or programmatically.
nunomaduro /
🍃 In short, it's like Tailwind CSS, but for the PHP command-line applications.
drush-ops /
Drush is a command-line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those who spend their working hours hacking away at the command prompt.