3
3
An ascii art generator that's actually good.
4
4
Does edge detection and selects the most appropriate characters.
5
5
6
+
7
+ <p align =" center " >
8
+ <img src =" ./rsrc/skykid.png " alt = " Blue Tit " >
9
+ </p >
10
+
11
+ <p align =" center " >
12
+ <img src =" ./rsrc/bluetit.png " alt = " Blue Tit " >
13
+ </p >
14
+
15
+ <p align =" center " >
16
+ <img src =" ./rsrc/niko.png " alt = " Niko from oneshot! " >
17
+ </p >
18
+
19
+ ## Installing
20
+
21
+ ### Installing with pip:
22
+
23
+ ```
24
+ pip install asciiartist
25
+ ```
26
+
27
+ ### Installing from wheel:
28
+
29
+ Download the wheel file from this project's releases and run
30
+
31
+ ```
32
+ pip install <path/to/wheel>
33
+ ```
34
+
35
+ ## Quick Start
36
+
37
+ ``` py
38
+ from asciiartist import asciiartist, display_edges
39
+ from PIL import Image
40
+
41
+ img = Image.open(" niko.png" )
42
+
43
+ art, edges = asciiartist(
44
+ img, # The image!
45
+ 30 , # Number of lines of the output ascii art
46
+ noise_reduction = 3 , # Level of noise reduction (optional)
47
+ line_weight = 1 , # Weight of the lines to draw (optional)
48
+ text_ratio = 2.2 # Height/width ratio of each character (optional)
49
+ )
50
+
51
+ print (art) # `art` is a string u can just print
52
+
53
+ # v Display the result of edge detection.
54
+ # Good for finetuning params.
55
+ display_edges(edges)
56
+ ```
57
+
58
+ ## Build from Source
59
+
60
+ Run the script ` ./model/model-gen.py ` and build the wheel with ` poetry build -f wheel ` .
61
+
62
+ ## How it works
63
+
64
+ Roughly, how _ Ascii Artist_ generates the drawings:
65
+
66
+ 1 . Run edge detection
67
+ 2 . Segment the image for each char
68
+ 3 . Pass each segment through a [ CNN] ( https://en.wikipedia.org/wiki/Convolutional_neural_network ) to get the most appropriate character.
69
+
70
+ The CNN is trained with distorted images of characters (in font consolas),
71
+ created in a way that emulates the output of the edge detection.
72
+
73
+ ## Bye
74
+
75
+ ^-^
76
+
6
77
```
7
78
_.C\=-C`~(
8
79
```o''*~C` `,
@@ -27,15 +98,4 @@ Does edge detection and selects the most appropriate characters.
27
98
-*``ELU-,*UF-~o_@o,_
28
99
___-~-`'`````` `` `''`````````[\ ``'
29
100
___-=-*'``` ___ U, --oIoE/ `,
30
- ```
31
-
32
- ## Installation and Usage
33
-
34
- ### Installing using Pip
35
-
36
- ```
37
- pip install asciiartist
38
- ```
39
-
40
- ## How it works
41
-
101
+ ```
0 commit comments