Coder Social home page Coder Social logo

juliapoo / asciiartist Goto Github PK

View Code? Open in Web Editor NEW
32.0 3.0 7.0 25.2 MB

An ascii art generator that's actually good. Does edge detection and selects the most appropriate characters.

License: MIT License

Python 100.00%
ascii-art python machine-learning edge-detection

asciiartist's Introduction

Ascii Artist

An ascii art generator that's actually good. Does edge detection and selects the most appropriate characters.

Blue Tit

Blue Tit

Niko from oneshot!

Installing

Installing with pip:

pip install asciiartist

Installing from wheel:

Download the wheel file from this project's releases and run

pip install <path/to/wheel>

Quick Start

from asciiartist import asciiartist, display_edges
from PIL import Image

img = Image.open("niko.png")

art, edges = asciiartist(
    img, # The image!
    30,  # Number of lines of the output ascii art
    noise_reduction=2,  # Level of noise reduction (optional)
    line_weight=1,      # Weight of the lines to draw (optional)
    text_ratio=2.2      # Height/width ratio of each character (optional)
)

print(art) # `art` is a string u can just print

# v Display the result of edge detection. 
#   Good for finetuning params.
display_edges(edges)

Build from Source

Run the script ./model/model-gen.py and build the wheel with poetry build -f wheel.

How it works

Roughly, how Ascii Artist generates the drawings:

  1. Run edge detection
  2. Segment the image for each char
  3. Pass each segment through a CNN to get the most appropriate character.

The CNN is trained with distorted images of characters (in font consolas), created in a way that emulates the output of the edge detection.

Bye

^-^

                                          __=E.L__      
                                        >#-=@>@F* `<_   
                                      _/`@o<FTFC@[_~_.__
                                   _./`\_`<__      @@7*`
                              _,~``      *v `^L_  )(    
                         _,~^C___ _    ````*@```````    
                   __,;@"*'`C` *@@_       _-V           
               __,@'^`CC)-[_L-----o,,}<@F--             
    __,-Ec>C<4@'C`'`"-[_,/   _,L-L             ,"       
 -`````          ````                       _-'         
                        _   _           __~``           
                        ``  "<`  _                      
                              `(V\_                     
                                `V(<_                   
                   _____,,~~<7oEE(@@_Eo@@Fo,            
       ___,-~-^````               .-.__V)  ,_           

asciiartist's People

Contributors

juliapoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

asciiartist's Issues

Install conflit

Hello,

thanx for the cool project,
but i came across this error :

image

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.