asciiart

command module
v0.0.0-...-c837ce4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 7 Imported by: 0

README

ASCII Art Converter

🚧 Heads up! This project is still in development - expect breaking changes along the way. 🚧

image

Overview

Tool to generate ASCII art from images with edge and angle detection.

Written in pure Go using standard libraries and the disintegration/gift module.

Pipeline
1. Original image
2. Preprocess the image with an Extended Difference of Gaussians filter to accenuate boundaries
3. Detect edges from the XDoG Output via a Sobel filter and calculate angles based on X/Y gradient magnitudes
                                                                                              |       //             |      
                                              ____________                                   //      //              |      
                      _______         __________ ____    ______________                      \\    ///               |     /
                   ///      ___________                               ___________             \\__//                 |   ///
               ////                                                              \______                             |  //  
            ////                                                                       ____\\                        |///   
         ///                                                 _________________              \\\\                            
     ////                                           _______/                   \___\_\|         ______                      
  ////                                         ______                                \\\             _\\                    
__//                                       /____                                        \__              \\                  
                                        ///                                              \_\             \\___              
                                     _//                                                   /\_           \__  \\\           
_\                                _///_                                                 /____/             \\_   \           
\\\                          __/_                                                     /\_      \_/               \\         
  |                    _______                                                       /_//                          \\\      
  |                ////                                                           ////                               \|     
 /|              ///                                                          ___/_                                   |     
//             |//                                                       /____        //|                             |     
//             //                                                        |           /_  |\                            \\\   
             //                                    /__                  |          /     \\                             \|  
           ///                                ____/___                  |         |       \\                             |  
          //                            ____//____/                     |         _\       \\\\                         ||  
          /                      ________ _ ///                         |\         ||          ____                     /|  
\\         \\               _____ |    //____          _____              \\\        |____        ___/                   |   
\\          \\\            \__________/       ______________________       \\           ___________                     |   
 \\           \\\             _        /________                  __________/                                          //   
   \\           \\_____       /________/                                                                             //     
    \\\               ________/                                                                                    //       
      \\\                                                                                                         //        
        \\\                                                                                                     ///         
          \\\\                                                                                               ////           
              \___                                                                                       __///              
                  \\\\                                                                                ////                  
                      \\__                                                                         ////                     
                          _____                                                               ____/                         
                               __________                                            _________                              
                                        _________                            _________                                      
                                                ______________________________                                              
                                                                                                                            
                                                                                                                             
4. Map the original image to ASCII characters based on luminence
 ..............           .............                                           .......::::::***++%%%+*:::::::::::::***++++%
  ...............            .........        ...:::..::::::.........              .......::::****++%%+*:..:::::::::::***+++++
             ..        .:****::.........:::**+++++++++++++++++++++++++**:......      .......::****++%+*:....::::::::::***++++*
                   .:*++++++++++++++++++++++++++++++++++++++++++++++++**+++++++++**:.   ......:::*++*:.......:::...::::**+++*:
                .:*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*****+***::::....:::::...............:::*****:.
             .*++++++++++%%%%+++++++++++++++++++++++++++++++++++++++++++++++++++**+++++*+***++*:....................::****::..
         .:*++++++%%%%%+++++++++++++++++++++++++++++++++++++++++::*******:**+**+++++**++*******+*:::...............:::***::...
      .:*+++%%++++++++++++++++++++++++++++++++++++++++++*****:.  .:..........:...::***::*+**************:...........::::::....
   .:*+++++%%++%+++++++++++++++++++++++++++++++++++*::...:. . .....      .:..:::.:..:::**++++************+:.........::::......
 *++++++++%%++%%%+++++++++++++++++++++++++++++**: .. ...:      ..::     ...........::*:.::***+++**********+*:..  .............
 +++++++++%++++%%%+++++++++++++++++++++++++*:        .  ...... .::.   ..  ..*:......::::.:*::**++++*************:.............
 ++++++++%++%+%%%+++++++++++++++++++++++*:.    .     .:....... .:::...   ... .. ...:::.::.:::*****++*****+*******+*...........
 *++++++%++%%+%+++++++++++++++++++++**:...      ...:.       .... ....:.    ...::.:::::::***+*****+****+++%+*******+*...... ...
  .*+++%+%%%+%+++++++++++++++++++*:.::.:..       ...      ...........::... ....:.:::*:::******+*****++%%%+%+*******+*:.    ...
   .++%++%%+++++++++++++++***::......:::.. :              :............::..:::::::::*::::***+++%+:*+++++%%%%+*********+*: ....
   :+%++%%++%+++++++++*:......::..:.:*....                   .. ...::::*:::::::::::::**+++++++++++%++++++++%%***********+. ...
  .++++%%++%+++++++**.........:.. ...:*.. ...        :**.:.......::****:.::::.::**++++++******+%%%++++++++++%+*******+*++. ...
 .++++%%++++**++***:..:::.....:..   . .:.....        ..:..:::::::::::....:**+++++++*********+%%%%+++++++++++%******+++*++:....
 +++++++++%+**+****:.....:.:..............::.....   ...:***::::::.......::**%%+++++*+*******+%%%%%+++++++++++************++:..
 ++++++++++***+***::.:....::.::...........::::::..::*******:.:::..... ::::*+%%++++++****:****+%%%%%+++++++++***************+..
 +++++++++********:::::::.:....::...::::::.::************:::::..     :::::*+%%+++++****::::::*+%%%%%+++++++******+++++++**++..
 +++++++++*******::::..:::::..::::::::::**************::::.       ...:::::*+%%++++******:...:::**++%%%+++****++++++++****++:..
 *++++++++*******:::::::::.:::::******+**********::::.... ....    .:.....::*+%%+++++++*:::::::::::::*******++++++++******++..:
 *+++++++++*****:::::*:..:*********:*++******::. ..::::*******:...:::::::..::*+++++**********************+++++***********+%:::
  *+++++++++++***::::.::*::************::..:::::****************************:*****+++++***************+++++++************++.::
   :++++++++++++****::.::..:::::::::::::*******+**++*+++++*********************++++++++++++++++++++++++++++++++++******+++...:
     :*++++++++++++******:::::::***********+++++++++++**++++++***********++++++++++++++++++++++++++++++++++++++++***++++:....:
      .*+++++++++++++++++++******+++++++++***++++++++++++++++++++++++++++***++++++++++++++++++++++++**+++++++*******++:.......
        :*+++++++++++++++++++++***++++++++++***++++++++++++++++++++++++++++++++++++++++++++++++++++++++++**********++:........
          .*+++++++++++++++++++++**++++++++++***++++++++++++++++++++++++++++++++++++++++++++++++++++++***********++*..........
             :**++++*++++++++++++***+++++++++++***++++++++++++++++++++++++++++++++++++*++++++++++++**********++++:. ..........
                .:**++++++++++++++***++++++++++++***+++++++++++++++*++++++++++++++++++++****************++++**:.  ............
                     :**++++++++++****++++++++++++****+++++++++++++++****++++++++++++++++*************+++*..        ..........
                        .:**++++++******++++++++++++****+++++++++++++*********+++++++++++*********++++*:       .  ............
                            ..:**++++++++++++++++++*********+++++++++*****************+++++++++++*:..         ................
                                  ..::******+++++++++**********++++++++***********++++++**:::..           ....................
                                            ..:*****++++++++++++++****+++++++++++**::.                 .......................
                                                      .........    ........                            .......................
                                                                                                      ........................
                                                                                                   ...........................
5. Overlay the edges onto the base ASCII mapping
 ..............           .............                                           .......::::::*|*++%%%+//::::::::::::*|*++++%
  ...............            .........        ..____________.........              .......::::*|/*++%%+//..:::::::::::*|*+++++
             ..        ._______.........__________+____++++______________......      .......::*\\*++%///....::::::::::*|*++++/
                   .:///++++++___________+++++++++++++++++++++++++++++**___________:.   ......::\\__//.......:::...::::|*++///
                .////++++++++++++++++++++++++++++++++++++++++++++++++++++++++++****\______::....:::::...............:::|**//:.
             .////+++++++%%%%+++++++++++++++++++++++++++++++++++++++++++++++++++**+++++*+____\\:....................::*|///:..
         .:///++++%%%%%++++++++++++++++++++++++++++++++++++++++_________________++++**++******\\\\::...............:::***::...
      .////+%%++++++++++++++++++++++++++++++++++++++++_______/.  .:..........:...\___\_\|+********______:...........::::::....
   .////+++%%++%+++++++++++++++++++++++++++++++++______..:. . .....      .:..:::.:..:::\\\+++**********_\\:.........::::......
 __//+++++%%++%%%+++++++++++++++++++++++++++/____ .. ...:      ..::     ...........::*:.:\__*+++**********\\:..  .............
 +++++++++%++++%%%++++++++++++++++++++++++///        .  ...... .::.   ..  ..*:......::::.:*\_\*++++********\\___:.............
 ++++++++%++%+%%%++++++++++++++++++++++_//.    .     .:....... .:::...   ... .. ...:::.::.:::/\_**++*****+*\__**\\\...........
 _\+++++%++%%+%++++++++++++++++++++_///_..      ...:.       .... ....:.    ...::.:::::::*/____/**+****+++%+*\\_***\*...... ...
  \\\++%+%%%+%+++++++++++++++++__/_.::.:..       ...      ...........::... ....:.:::*:::/\_***+**\_/++%%%+%+*******\\:.    ...
   .|+%++%%++++++++++++++_______.....:::.. :              :............::..:::::::::*::/_//*+++%+:*+++++%%%%+********\\\: ....
   :|%++%%++%++++++++////.....::..:.:*....                   .. ...::::*::::::::::::////++++++++++%++++++++%%**********\|. ...
  ./|++%%++%+++++++///........:.. ...:*.. ...        :**.:.......::****:.::::.::___/_+++******+%%%++++++++++%+*******+*+|. ...
 .//++%%++++**++*|//..:::.....:..   . .:.....        ..:..:::::::::::....:*/____+++*****//|*+%%%%+++++++++++%******+++*+|:....
 //+++++++%+**+*//*:.....:.:..............::.....   ...:***::::::.......::|*%%+++++*+*/_**|\+%%%%%+++++++++++***********\\\:..
 ++++++++++***+//*::.:....::.::...........::::::..::*/__***:.:::..... ::::|+%%++++++*/**:**\\+%%%%%+++++++++**************\|..
 +++++++++***///**:::::::.:....::...::::::.::***____/___*:::::..     :::::|+%%+++++*|**:::::\\+%%%%%+++++++******+++++++**+|..
 +++++++++**//***::::..:::::..::::::::::**____//____/*::::.       ...:::::|+%%++++**_\**:...:\\\\++%%%+++****++++++++****+||..
 *++++++++**/****:::::::::.:::::***________*_*///::::.... ....    .:.....:|\+%%++++++||::::::::::____******++++++++******+/|.:
 \\++++++++*\\**:::::*:..:***_____*|*++*//____:. ..::::*_____*:...:::::::..\\\+++++***|____********___/**+++++***********+|:::
  \\++++++++++\\\::::.::*::**\__________/..:::::______________________******:\\***+++++***___________*+++++++************+|.::
   \\+++++++++++\\\*::.::..:::::_:::::::*/________++*+++++**********__________/++++++++++++++++++++++++++++++++++******++//..:
     \\+++++++++++\\_____:::::::/________/*+++++++++++**++++++***********++++++++++++++++++++++++++++++++++++++++***+++//....:
      \\\+++++++++++++++________/+++++++++***++++++++++++++++++++++++++++***++++++++++++++++++++++++**+++++++*******+//.......
        \\\++++++++++++++++++++***++++++++++***++++++++++++++++++++++++++++++++++++++++++++++++++++++++++**********+//........
          \\\++++++++++++++++++++**++++++++++***++++++++++++++++++++++++++++++++++++++++++++++++++++++***********+///.........
            \\\\++++*++++++++++++***+++++++++++***++++++++++++++++++++++++++++++++++++*++++++++++++**********++//// ..........
                \___++++++++++++++***++++++++++++***+++++++++++++++*++++++++++++++++++++****************+++__///  ............
                    \\\\++++++++++****++++++++++++****+++++++++++++++****++++++++++++++++*************++////        ..........
                        \\__++++++******++++++++++++****+++++++++++++*********+++++++++++*********+++////      .  ............
                            _____++++++++++++++++++*********+++++++++*****************++++++++++____/         ................
                                 __________*+++++++++**********++++++++***********+++++_________          ....................
                                          _________*++++++++++++++****+++++++++_________               .......................
                                                  ______________________________                       .......................
                                                                                                      ........................
                                                                                                   ...........................
Installation

To install as CLI:

go install github.com/jeffc25/asciiart@latest

To install as project dependency:

go get github.com/jeffc25/asciiart
Usage

🚧 WIP 🚧

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL