README ¶
ASCII Art Converter
🚧 Heads up! This project is still in development - expect breaking changes along the way. 🚧
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 ¶
There is no documentation for this package.
Click to show internal directories.
Click to hide internal directories.