Git Product home page Git Product logo

img2ascii's Introduction

Img2Asii

A small PHP library to generate ASCII art from images

Example Output

Example Output

Installation

Install it using composer:

composer require bylexus/img2ascii

Usage

// Include the main class in your namespace:
use Img2Ascii\Processor;

$processor = new Processor('path/to/img.png');

// Default Usage: Creates a b/w ascii-art textfile with 10px per char:
$processor->asciify()->result()->writeFile('output.txt');

// If you want to have some more control over the output:
$processor
    ->asciify(5)                      // pixel width per char
    ->result('#@Mm+:-.')              // Chars to use, from darkest to lightest
    ->writeFile('filename.txt','\n'); // filename and line ending char

// If you want to define the final output width instead of
// the pixel block width, use:
$processor->asciifyToWidth(100); // Creates 100 ascii chars in width


// Love colors instead of black/white? go ahead:
$processor
    ->asciify(10)
    ->colorResult('#')                      // In color mode, only a single char is used
    ->writeFile('filename.html','<br />');  // define line ending

... To be continued, work in progress ...

img2ascii's People

Contributors

bylexus avatar

Stargazers

 avatar Davi avatar  avatar Sterling Stokes avatar Antony avatar Cristei Gabriel-Marian avatar  avatar 简爱 avatar jay avatar Mohammad Hassan Pezeshkian avatar EVOKE avatar Mustafa Hayri ÜNEŞİ avatar Wakaba Chan avatar Joshua Behrens avatar  avatar Tomasz Sawicki avatar Zeng Xi avatar WingZero avatar Joseph Bergdoll avatar - avatar Katsuro Kurosaki avatar 空格不在 avatar Kyousuke_W avatar Arthur avatar

Watchers

James Cloos avatar WingZero avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.