Skip to content

Commit dfe84a1

Browse files
authored
Merge pull request #6 from tolik518/translations-and-help-param
2 parents f58b360 + c4fd876 commit dfe84a1

29 files changed

+671
-112
lines changed

Cargo.lock

Lines changed: 144 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "bitmap_type_tracer"
33
authors = ["tolik518"]
4-
version = "1.0.0"
4+
version = "1.1.0"
55
edition = "2021"
66
rust-version = "1.65"
77
description = "bitmap_type_trace is a utility tool to generate images from font bitmaps with customizable configurations"
@@ -20,11 +20,14 @@ debug-assertions = false
2020
overflow-checks = false
2121
incremental = false
2222
opt-level = 3
23-
strip = true # Automatically strip symbols from the binary.
24-
lto = true # Enable link-time optimization.
23+
strip = true
24+
lto = true
2525

2626
[dependencies]
27-
image = "0.23.14"
28-
serde = { version = "1.0", features = [] }
29-
serde_json = "1.0"
30-
serde_derive = { version = "1.0", features = [] }
27+
image = "0.23.14" # Image processing
28+
serde = { version = "1.0", features = [] } # Serialization
29+
serde_json = "1.0" # JSON
30+
serde_derive = { version = "1.0", features = [] } # Serialization
31+
locale_config = "0.3" # System locale
32+
once_cell = { version = "1.8", features = [] } # Lazy statics
33+

README.md

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
<div align="center">
2+
13
# ![bitmap_type_tracer](./logo.png)
24
![Crates.io](https://img.shields.io/crates/v/bitmap_type_tracer)
35
![Crates.io](https://img.shields.io/crates/d/bitmap_type_tracer)
6+
![GitHub issues](https://img.shields.io/github/issues/tolik518/bitmap_type_tracer)
7+
![GitHub pull requests](https://img.shields.io/github/issues-pr/tolik518/bitmap_type_tracer)
8+
9+
`bitmap_type_tracer` is a utility tool, written in Rust, for generating text-images using a provided bitmap-font (and a set of configuration parameters).
410

5-
`bitmap_type_tracer` is a utility tool for generating text-images using a provided bitmap-font (and a set of configuration parameters).
11+
</div>
612

713
## Features
814
- Generate images from a font bitmap using a custom sequence and text.
@@ -74,6 +80,8 @@ This command will generate an image using a previously saved font configuration
7480

7581
- `--save-json`: Save the provided configuration as a JSON file, making it easier to reuse in the future.
7682

83+
- `--lang en|it|fr|en`: Specify the language of the text. Default is your System language if supported, otherwise its set to en.
84+
7785
## Modules
7886

7987
- `main.rs`: The main driver of the application, handling command line arguments and invoking image generation.
@@ -87,89 +95,95 @@ This command will generate an image using a previously saved font configuration
8795
_/examples/4138906397_0dc616813b_o.png_
8896
![](./examples/4138906397_0dc616813b_o.png)
8997
```bash
90-
bitmap_font_tool examples/4138906397_0dc616813b_o.png " \!\" '()*+,-.\\0123456789:; = ? ABCDEFGHIJKLMNOPQRSTUVWXYZ " tolik518 10
98+
bitmap_type_tracer examples/4138906397_0dc616813b_o.png " \!\" '()*+,-.\\0123456789:; = ? ABCDEFGHIJKLMNOPQRSTUVWXYZ " tolik518 10
9199
```
92-
![](./examples/4138906397_0dc616813b_o.png_tolik518.png)
100+
![](examples/outputs/4138906397_0dc616813b_o.png_tolik518.png)
93101

94102
---------------------------------------
95103

96104
_/examples/4138906425_29cbc92641_o.png_
97105
![](./examples/4138906425_29cbc92641_o.png)
98106
```bash
99-
bitmap_font_tool examples/4138906425_29cbc92641_o.png " \!\" '()*+,-.\\0123456789:; = ? ABCDEFGHIJKLMNOPQRSTUVWXYZ " tolik518 10
107+
bitmap_type_tracer examples/4138906425_29cbc92641_o.png " \!\" '()*+,-.\\0123456789:; = ? ABCDEFGHIJKLMNOPQRSTUVWXYZ " tolik518 10
100108
```
101-
![](./examples/4138906425_29cbc92641_o.png_tolik518.png)
109+
![](examples/outputs/4138906425_29cbc92641_o.png_tolik518.png)
102110

103111
---------------------------------------
104112

105113
_/examples/FONT34.png_
106114
![](./examples/FONT34.png)
107115
```bash
108-
bitmap_font_tool examples/FONT34.png " \! () , . 0123456789:; - ? ABCDEFGHIJKLMNOPQRSTUVWXYZ " tolik518 20 --bottom 150 --threshold 20
116+
bitmap_type_tracer examples/FONT34.png " \! () , . 0123456789:; - ? ABCDEFGHIJKLMNOPQRSTUVWXYZ " tolik518 20 --bottom 150 --threshold 20
109117
```
110-
![](./examples/FONT34.png_tolik518.png)
118+
![](examples/outputs/FONT34.png_tolik518.png)
111119

112120
---------------------------------------
113121

114122
_/examples/font228.png_
115123
![](./examples/font228.png)
116124
```bash
117-
bitmap_font_tool examples/font228.png "ABCDEFGHIJKLMNOPQRSTUVWXYZ>.: " tolik518 10 --threshold 0
125+
bitmap_type_tracer examples/font228.png "ABCDEFGHIJKLMNOPQRSTUVWXYZ>.: " tolik518 10 --threshold 0
118126
```
119127
Since the number are missing from the sequence, they are not generated in the image and it tries to fill the space with the background.
120128
The background was not recognized properly, so it was filled with the brown instead of black.
121-
![](./examples/font228.png_tolik518.png)
129+
![](examples/outputs/font228.png_tolik518.png)
122130

123131
---------------------------------------
124132

125133
_/examples/font239r.png_
126134
![](./examples/font239r.png)
127135
```bash
128-
bitmap_font_tool examples/font239r.png "ABCDEFGHIJKLMNOPQRSTUVWXYZ()\!?.,’ " tolik518 7 --bottom 4 --threshold 1
136+
bitmap_type_tracer examples/font239r.png "ABCDEFGHIJKLMNOPQRSTUVWXYZ()\!?.,’ " tolik518 7 --bottom 4 --threshold 1
129137
```
130138
Since the number are missing from the sequence, they are not generated in the image and it tries to fill the space with the background, but the threshold is set to 1, so it doesn't fill the space with the transparent background since it recognized the black background.
131-
![](./examples/font239r.png_tolik518.png)
139+
![](examples/outputs/font239r.png_tolik518.png)
132140

133141
---------------------------------------
134142

135143
_/examples/font244r.png_
136144
![](./examples/font244r.png)
137145
```bash
138-
bitmap_font_tool examples/font244r.png "ALW6BMX7CNY8DOZ9EP*\!FQ0?GR1.HS2 IT3 JU4 KV5 " tolik518 4 --threshold 30
146+
bitmap_type_tracer examples/font244r.png "ALW6BMX7CNY8DOZ9EP*\!FQ0?GR1.HS2 IT3 JU4 KV5 " tolik518 4 --threshold 30
139147
```
140148
We needed a threshold of 30 to remove the black background.
141-
![](./examples/font244r.png_tolik518.png)
149+
![](examples/outputs/font244r.png_tolik518.png)
142150

143151
---------------------------------------
144152

145153
_/examples/font248r.png_
146154
![](./examples/font248r.png)
147155
```bash
148-
bitmap_font_tool examples/font248r.png "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 \!?." tolik518 20 --threshold 60
156+
bitmap_type_tracer examples/font248r.png "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 \!?." tolik518 20 --threshold 60
149157
```
150158
To have a better result, we needed a threshold of 60 to remove the black background.
151-
![](./examples/font248r.png_tolik518.png)
159+
![](examples/outputs/font248r.png_tolik518.png)
152160

153161
---------------------------------------
154162

155163
_/examples/MEGAD.png_
156164
![](./examples/MEGAD.png)
157165
```bash
158-
bitmap_font_tool examples/MEGAD.png "'() +,-. 0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ ! =? " tolik518 10 --bottom 10 --threshold 1
166+
bitmap_type_tracer examples/MEGAD.png "'() +,-. 0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ ! =? " tolik518 10 --bottom 10 --threshold 1
159167
```
160168
In this example, we needed to add a bottom margin of 10 for the characters to align properly.
161-
![](./examples/MEGAD.png_tolik518.png)
169+
![](examples/outputs/MEGAD.png_tolik518.png)
162170

163171
---------------------------------------
164172

165173
_/examples/MEGAD2.png_
166174
![](./examples/MEGAD2.png)
167175
```bash
168-
bitmap_font_tool examples/MEGAD2.png "AGMSY+:4BHNTZ\!;5CIOU.?06DJPV;(17EKQW\")28FLRX-'39" tolik518 8 --bottom 3 --threshold 1
176+
bitmap_type_tracer examples/MEGAD2.png "AGMSY+:4BHNTZ\!;5CIOU.?06DJPV;(17EKQW\")28FLRX-'39" tolik518 8 --bottom 3 --threshold 1
169177
```
170-
![](./examples/MEGAD2.png_tolik518.png)
178+
![](examples/outputs/MEGAD2.png_tolik518.png)
171179

172180

173181
## Contributions
174182

175183
Feel free to contribute by opening issues or pull requests. All feedback is welcome!
184+
185+
<div align="center">
186+
187+
![Rust love](https://www.gstatic.com/android/keyboard/emojikitchen/20220506/u1f498/u1f498_u1f980.png)
188+
189+
</div>

examples/4138906397_0dc616813b_o.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"font_name": "4138906397_0dc616813b_o",
32
"sequence": " !\" '()*+,-.\\0123456789:; = ? ABCDEFGHIJKLMNOPQRSTUVWXYZ ",
43
"chars_per_row": 10,
54
"top_margin": 0,

examples/4138906425_29cbc92641_o.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"font_name": "4138906425_29cbc92641_o",
32
"sequence": " !\" '()*+,-.\\0123456789:; = ? ABCDEFGHIJKLMNOPQRSTUVWXYZ ",
43
"chars_per_row": 10,
54
"top_margin": 0,

examples/FONT34.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"font_name": "FONT34",
32
"sequence": " ! () , . 0123456789:; - ? ABCDEFGHIJKLMNOPQRSTUVWXYZ ",
43
"chars_per_row": 20,
54
"top_margin": 0,

examples/MEGAD.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"font_name": "MEGAD",
32
"sequence": "'() +,-. 0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ ! =? ",
43
"chars_per_row": 10,
54
"top_margin": 0,

examples/MEGAD2.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"font_name": "MEGAD",
32
"sequence": "AGMSY+:4BHNTZ!;5CIOU.?06DJPV;(17EKQW\")28FLRX-'39",
43
"chars_per_row": 8,
54
"top_margin": 0,

examples/font228.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"font_name": "font228",
32
"sequence": "ABCDEFGHIJKLMNOPQRSTUVWXYZ>.: ",
43
"chars_per_row": 10,
54
"top_margin": 0,

0 commit comments

Comments
 (0)