convert2ascii 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +42 -13
- data/Rakefile +13 -0
- data/exe/image2ascii +1 -1
- data/exe/video2ascii +3 -3
- data/lib/convert2ascii/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ba7bbea3873db90bd7d9d7806f9861bd409489789b85d2a6598fd117fb7f7d2
|
4
|
+
data.tar.gz: e2e931cac272e36341bfbd6554634dfcc25401a58e7c6f2c8bc79c5b9127a8f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeaf96c3b3e0699785dc0706ccffed9acea4fcf6500d53862a98509d1047416621db0d27100d59f9c7b00fa94dac6a5e99dd71cdd48f5f183830152b06a5380c
|
7
|
+
data.tar.gz: f952e61a0e3c47d97390edef85f4400e3467761186cac528ba4e349a4931caae4b5c5d3284062fe871f761a2cef41903e377ea84d8f3aababfcd97ad6e74728e
|
data/README.md
CHANGED
@@ -1,8 +1,23 @@
|
|
1
|
-
#
|
1
|
+
# Convert2Ascii
|
2
2
|
|
3
3
|
Convert Image/Video to ASCII art.
|
4
4
|
|
5
5
|
|
6
|
+
## Intro
|
7
|
+
|
8
|
+
convert2ascii provides two executable commands:
|
9
|
+
|
10
|
+
* image2ascii: transform picture to ascii art and display in terminal.
|
11
|
+
* video2ascii: transform video to ascii art, you can save or play it in terminal.
|
12
|
+
|
13
|
+
It also provides classes as a gem:
|
14
|
+
|
15
|
+
* Convert2Ascii::Image2Ascii
|
16
|
+
* Convert2Ascii::Video2Ascii
|
17
|
+
|
18
|
+
you can use it in your code and make your own ascii art !
|
19
|
+
|
20
|
+
|
6
21
|
## Test pass
|
7
22
|
|
8
23
|
* MacOS 15.2 ✅
|
@@ -20,44 +35,57 @@ Convert Image/Video to ASCII art.
|
|
20
35
|
|
21
36
|
## Prerequisites
|
22
37
|
|
23
|
-
*
|
38
|
+
* Ruby 3+
|
24
39
|
* ImageMagick ([Download here](https://imagemagick.org/script/download.php))
|
25
40
|
* ffmpeg ([Download here](https://www.ffmpeg.org/))
|
26
41
|
|
42
|
+
# How to use
|
43
|
+
|
44
|
+
## Try in Docker
|
45
|
+
|
46
|
+
`$ docker run -it -v $(pwd):/app mark24code/convert2ascii bash -c "cd /app && exec bash"`
|
27
47
|
|
28
|
-
|
48
|
+
> `$(pwd)` can be changed to your local path. Here, use your working path.
|
49
|
+
|
50
|
+
|
51
|
+
## Install
|
52
|
+
|
53
|
+
`$ gem install convert2ascii`
|
54
|
+
|
55
|
+
|
56
|
+
## Executable commands
|
29
57
|
|
30
58
|
### image2ascii
|
31
59
|
|
32
|
-
|
60
|
+
Convert an image to ascii art.
|
33
61
|
|
34
62
|
```bash
|
35
63
|
image2ascii -h
|
36
64
|
Usage: image2ascii [options]
|
37
|
-
--version
|
65
|
+
--version version
|
38
66
|
-i, --image=URI image uri (required)
|
39
67
|
-w, --width=WIDTH image width (integer)
|
40
|
-
-s, --style=STYLE ascii style:
|
41
|
-
-b, --block ascii color style use BLOCK or not
|
68
|
+
-s, --style=STYLE ascii style: 'color'/'text'
|
69
|
+
-b, --block ascii color style use BLOCK or not true/false
|
42
70
|
```
|
43
71
|
|
44
72
|
### video2ascii
|
45
73
|
|
46
|
-
|
74
|
+
Convert a video to ascii art.
|
47
75
|
|
48
76
|
```bash
|
49
77
|
Usage: video2ascii [options]
|
50
78
|
|
51
|
-
* default will generate and play without
|
52
|
-
* -p will just play ascii frames
|
79
|
+
* By default, it will generate and play without saving.
|
80
|
+
* The -p option will just play the ascii frames within the directory, and ignore -i, -o other options. --loop will play loop
|
53
81
|
* -i,-o will just generate and output frames and ignore others options
|
54
|
-
--version
|
82
|
+
--version version
|
55
83
|
-i, --input=URI video uri (required)
|
56
84
|
-w, --width=WIDTH video width (integer)
|
57
85
|
-s, --style=STYLE ascii style: ['color'| 'text']
|
58
86
|
-b, --block ascii color style use BLOCK or not [ true | false ]
|
59
|
-
-o, --ouput=OUTPUT save ascii
|
60
|
-
-p, --play_dir=PLAY_DIRNAME input ascii frames
|
87
|
+
-o, --ouput=OUTPUT save ascii frames to the output directory
|
88
|
+
-p, --play_dir=PLAY_DIRNAME input the ascii frames directory to play
|
61
89
|
--loop
|
62
90
|
```
|
63
91
|
|
@@ -108,6 +136,7 @@ ascii.generate.play
|
|
108
136
|
|
109
137
|
```
|
110
138
|
|
139
|
+
|
111
140
|
## Inspired by
|
112
141
|
|
113
142
|
* [michaelkofron/image2ascii](https://github.com/michaelkofron/image2ascii)
|
data/Rakefile
CHANGED
@@ -14,6 +14,19 @@ task :build_rdoc do
|
|
14
14
|
system("rdoc build")
|
15
15
|
end
|
16
16
|
|
17
|
+
desc "Build Docker image"
|
18
|
+
task :build_docker do
|
19
|
+
system("docker build . -t mark24code/convert2ascii:latest")
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Push Docker image"
|
23
|
+
task :push_docker do
|
24
|
+
system("docker push mark24code/convert2ascii:latest")
|
25
|
+
end
|
17
26
|
|
27
|
+
desc "Run in docker"
|
28
|
+
task :run_in_docker do
|
29
|
+
system("docker run -it -v $(pwd):/app mark24code/convert2ascii bash -c \"cd /app && exec bash\"")
|
30
|
+
end
|
18
31
|
|
19
32
|
task default: %i[]
|
data/exe/image2ascii
CHANGED
@@ -7,7 +7,7 @@ options = {}
|
|
7
7
|
OptionParser.new do |parser|
|
8
8
|
parser.banner = "Usage: image2ascii [options]"
|
9
9
|
|
10
|
-
parser.on("--version", "
|
10
|
+
parser.on("--version", "version") do |v|
|
11
11
|
puts "convert2ascii/image2ascii: v#{::Convert2Ascii::VERSION}"
|
12
12
|
puts "author: Mark24"
|
13
13
|
puts "mail: mark.zhangyoung@gmail.com"
|
data/exe/video2ascii
CHANGED
@@ -45,7 +45,7 @@ Usage: video2ascii [options]
|
|
45
45
|
* -p will just play ascii frames dir, and ignore -i, -o others options. --loop will play loop
|
46
46
|
* -i,-o will just generate and output frames and ignore others options
|
47
47
|
DOC
|
48
|
-
parser.on("--version", "
|
48
|
+
parser.on("--version", "version") do |v|
|
49
49
|
puts "convert2ascii/video2ascii: v#{::Convert2Ascii::VERSION}"
|
50
50
|
puts "author: Mark24"
|
51
51
|
puts "mail: mark.zhangyoung@gmail.com"
|
@@ -82,11 +82,11 @@ DOC
|
|
82
82
|
options[:color_block] = color_block || false
|
83
83
|
end
|
84
84
|
|
85
|
-
parser.on("-o", "--ouput=OUTPUT", "save ascii
|
85
|
+
parser.on("-o", "--ouput=OUTPUT", "save ascii frames to the output directory") do |output|
|
86
86
|
options[:output] = output
|
87
87
|
end
|
88
88
|
|
89
|
-
parser.on("-p", "--play_dir=PLAY_DIRNAME", "input ascii frames
|
89
|
+
parser.on("-p", "--play_dir=PLAY_DIRNAME", "input the ascii frames directory to play") do |play_dir|
|
90
90
|
options[:play_dir] = play_dir
|
91
91
|
end
|
92
92
|
|