User Tools

Site Tools


ascii_art

This is an old revision of the document!


ASCII Art

            $$$$$$$$              $$$$$$
           m$$$$$$$$$          m$"""" "$$m             
           $$$$$$$$$$         $" m$$$$m""$m           
          mm$$$$$$$$$$$$$$$"" $     "$$mm$$           
          m""        """$$$$$mm      "$$$$$           
      mmm$$m$$m$$mmmmm   """"$$$"    m$$$"            
    ""$m   $$$""""""$$$mm            $$$$m            
       $                ""           mm$$$$           
     mm"                      mm$$$$$$$$$$$           
     $                      m$$$$""    ""$$$          
     $                      $$""       m "$$m         
    $                      """   mm$$$$$$$$$$         
    $                          m$$$$$""""$$$"         
     $  mm    mm               $$"       "$$          
     $ $"$$  $"$$                         "$""""      
      $"m"   "m$"                           m""""     
     m$ m"""m                                "mmm""   
    $ mmmm                                   ""       
 mmm$$""""""$$                                m""""$  
m$$"  mm$$$$$$$                                mm     
$$  $$$$$$$$$$$$         mmm                "$m "$m   
"$$$$$$$$$$$$$$$         m$m"                m     "  
 ""$$$$$$$$$$$$"       m$$$$                 ""mm     
   $""$$$$$""         m$$$$                m mmm "    
   "m              m$$$$$$            mm$mmmm  ""     
    ""mmm     mmm$$""$$$"            $$""m   "        
         """""   "$mm$"     m        $$               
                m         m$"        $$               
                "$$$$$mm$""          ""               
                   """"                           

Step 0. Choose an image

Choose the first image that you want to convert into ASCII art. It’s good to start with an image around 640×480. It can be in color, a photo, or a drawing. Light pixels will be represented by small characters like a dot (.), which leave lots of the background exposed. On the other extreme, a dense characters like $, are used to cover the background.

Step 1. Read your image and print its height and width in pixels

Step 2. Load your image’s pixel data into a 2-dimensional array

Step 3. Convert the RGB tuples of your pixels into single brightness numbers

Step 4. Convert brightness numbers to ASCII characters

Step 5. What if it looks your image looks squashed?

ascii_art.1679670173.txt.gz · Last modified: 2023/03/24 11:02 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki