#ascii #art #image #cli

app aarty

A simple CLI tool to convert the images to ASCII art

18 unstable releases (3 breaking)

0.4.7 Nov 14, 2022
0.4.6 Nov 13, 2022
0.3.9 Nov 12, 2022
0.2.9 Nov 9, 2022
0.1.0 Oct 3, 2022

#139 in Text processing

49 downloads per month

MIT license

16KB
209 lines

aarty: A simple CLI tool to convert images to ASCII art with Rust 🦀

srceenshots/anime_2_colored_scale_4.gif money mouth face colored scale 2 money mouth face normal scale 2

More screenshots

crab colored scale 1 Original image crap colored scale Original image nerd face colored scale Original image nerd face normal scale Original image srceenshots/anime_2_colored_scale_4.gif Original image anime colored scale 3 Original image

           ~~~~~~~!!!!~!!~                ~!!!!!!!!!~~~~~           
         ~~~~!!!!!!!!!!!!!!!!           !!!!!!!!!!!!!!!!~~~~        
       ~~~~~!!!!!!!!!!!!!!!!!!~       !!!!!!!!!!!!!!!!!!!!~~~~      
      ~~~~~~!!!!!!!!!!!!!!!!!!!~    ~!!!!!!!!!!!!!!!!!!!!!!~~~~     
     ~~~~~~~!!!!!!!!!!!!!!!!!!!!!  !!!!!!!!!!!!!!!!!!!!!!!!~~~~~    
    ~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!~!!!!!!!!!!!!!!!!!!!!!!!!~~~~~    
    ~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~    
    ~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~    
    ~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~~    
    ~~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~~    
     ~~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~~~    
     ~~~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~~~     
      ~~~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~~~      
       ~~~~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~       
        ~~~~~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~        
          ~~~~~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~         
           ~~~~~~~~~~~~~~~!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~           
             ~~~~~~~~~~~~~~~~~~~~~!!!~~~~~~~~~~~~~~~~~~~            
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~              
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                  
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~                    
                      ~~~~~~~~~~~~~~~~~~~~~~~~                      
                         ~~~~~~~~~~~~~~~~~~~                        
                           ~~~~~~~~~~~~~~~                          
                             ~~~~~~~~~~                             
                                ~~~~~                

Install

  • from crates.io
    cargo install aarty
    
  • From aur:
    yay -S aarty
    

Options and arguments

aarty --help
A simple CLI tool to convert the images to ASCII art

Usage: aarty [OPTIONS] <IMAGE>

Arguments:
  <IMAGE>
          The image to convert to ASCII art

Options:
  -m, --mode <MODE>
          The art mode to use
          
          [default: normal-ascii]

          Possible values:
          - normal-ascii: Normal ASCII art
          - colored:      Colored ASCII art, the colors are based on the terminal colors

      --output-method <OUTPUT_METHOD>
          [default: stdout]

          Possible values:
          - file:   Save the ascii art to a file
          - stdout: Print the ascii art to the terminal

  -c, --characters <CHARACTERS>
          The character to use for drawing the image (lighter to darker) You can user one character if you uses the color mode
          
          [default: " .,-~!;:=*&%$@#"]

  -s, --scale <SCALE>
          The output scale (1 is the original size)
          
          [default: 4]

  -w, --width <WIDTH>
          Enstablish how much wide is the output images, in columns. Overrides `scale`

  -b, --background <BACKGROUND>
          The background color to use

  -o, --output <OUTPUT>
          The output file to write to (if output_method is file)
          
          [default: ascii_image.txt]

  -h, --help
          Print help information (use `-h` for a summary)

  -V, --version
          Print version information

Examples

aarty -m images/airplane.png
                         :=:**    
                        =***:*    
   ~~!!!~~~~~~~ ~~~   =*****=     
         ~~~!!!!!!!!=*****=       
                 ~:*****=         
                :===**:!~         
              ;======~!!~~        
            ;:===::   ~!~         
          ;:;~:::     ~!!~~       
     ~~!!;~~:;         !!~        
        ~~!!~          ~!~        
          ~!~           !~        
           ~~           ~~        
aarty -m colored images/airplane.png

airplane colored scale 4

aarty -m colored images/airplane.png -s 2

airplane colored scale 2

aarty -c " ~okOK#\$%" images/ok_hand.png
                                        
                     $$$#               
                     #$$$$#             
                  K#KO#$$$$#            
                  k###O#$$$$#           
                    kK#OK$$$$#K         
                      OKKO#$$$#         
              O#$$#O    KKK$$$$#        
         K$$$$$$$$$$$$$#OOk#$$$#K       
         K$$$$$$$$$$$$$$$$##K#$$#K      
       #$K OO     OK#$$$$$$$$$$###      
      #$$$$#         OO##$$$$$$$$$#     
      O#$$$$#          #$$$$$$$$$$KO    
       K#$$$$#       K#$$$$$$$$$$KO     
       O#$$$$$$#KK####$$$$$$$$$##K      
         K#$$$$$$$$$$$$$$$$$$$$#KO      
          K##$$$$$$$$$$$$$$$$$##O       
           kK###$$$$$$$$$$$$###K        
             OK######$$######KO         
                OOKKKKKKKKOO            
aarty -c " ~okOK#\$%" images/ok_hand.png -m colored

ok hand colored scale 4 custome chars

aarty -c " ~okOK#\$%" images/ok_hand.png -m colored --output-method file -o ok_ascii.txt

ok hand colored scale 4 custome chars in file

If you get here, don't forget the star yooo ⭐

License MIT

Dependencies

~16MB
~222K SLoC