jankovicsandras / imagetracerjs

Simple raster image tracer and vectorizer written in JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ASCII-Art

anonimo82 opened this issue · comments

Hello everyone.
I'd like this to generate ASCII-Art too, it's possible using a very similar algorithm.
Here's an example:

                                               ╥,«dÇ,,                          
                                            ,╦░░░░╩╨^`                          
                    ╦w,                    ╔Ñ░░░░░░░╦N╥,                        
                    ╘░░░░N╥╥              ]░░░░░░░░░░░░░░╥                      
                     `╨░░░░░░░╦╥,        ]░░░░░░░░░░░░░░░░░╥                    
                     ,╥╦░░░░░░░░░░Ñ╦,   ]░░░░░░░░░░░░░░░░░░░N                   
                      ╩░░░░░░░░░░░░░░]w]░░░░░░░░░░░░░░░░░░░░░H     ,            
                       "╨Ñ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░Ñ╙`            
                        ,≤╦░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╦╥╥╥╥            
                        ╙╩░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░Ñ╨╨╙^`             
                          `"^╨░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░`                  
                            j░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░`                   
                             "╚╩╩░░░░░░░░░░░░░░░░░░░░░░░░░Ñ`                    
            »,                ╥╦░░░░░░░░░░░░░░░░░░░░░░░░░^                      
              ╚N╥╥,.    ,,«gÑ░░░░░░░░░░░░░░░░░░░░░░░░░Ñ^                        
                "╩░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░Ñ╨`                          
                   "╚╩░░░░░░░░░░░░░░░░░░░░░░░░░Ñ╨^`                             
                       `"╙╨Ñ╦░░░░░░░░░░░Ñ╩╨╙^`                                  

This is the Twitter logo, made from this image:
twitter-logo-small

Another popular ASCII-Art style is just represent edges (with no shade) as in the following example:

/__/__/__/__/__/
     /__/
    /__/
   /__/
  /__/
 /__/
/__/

This is the letter "T".

Both kinds of ASCII-Art could be easily got from your algorithm.

Please, I hope you'll consider my idea =)

Bye, Ivano.

Hi,

ASCII art is a raster image, made of characters instead of pixels. ImageTracer is not practical for this, because ImageTracer creates vector graphics, geometric shapes.

But take a look at "Image to slashes" in https://github.com/jankovicsandras/misc .

( or https://github.com/jankovicsandras/misc/blob/master/image_to_slashes/image_to_slashes.html )

This converts pixels to characters.

For edge characters ( e. g. the first line ╥,«dÇ,, in your example ), you can select the character based on the RGB difference of the actual pixel and its neighbors.

I hope this helps, you can reopen the Issue if you have more questions.

I see, thanks.
And sorry for the noise