๐Ÿ“ฆ tolik518 / bitmap_type_tracer

Utility tool to generate text-images from Bitmaps-fonts

โ˜… 5 stars โ‘‚ 2 forks ๐Ÿ‘ 5 watching
bitmap-fontdemoscenefonthacktoberfest
๐Ÿ“ฅ Clone https://github.com/tolik518/bitmap_type_tracer.git
HTTPS git clone https://github.com/tolik518/bitmap_type_tracer.git
SSH git clone git@github.com:tolik518/bitmap_type_tracer.git
CLI gh repo clone tolik518/bitmap_type_tracer
tolik518 tolik518 split into cli and lib de3db89 1 years ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ examples
๐Ÿ“„ .gitignore
๐Ÿ“„ Cargo.lock
๐Ÿ“„ Cargo.toml
๐Ÿ“„ logo.png
๐Ÿ“„ README.md
๐Ÿ“„ README.md

bitmap<em>type</em>tracer

Crates.io Crates.io GitHub issues GitHub pull requests

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).

Features

  • Generate images from a font bitmap using a custom sequence and text.
  • Load and save font configurations for reuse.
  • Customize margins and threshold for more precise image generation.

Getting Started

Font Source

The fonts used in this project are sourced from ianhan/BitmapFonts repository.

Installation

Make sure you have Rust installed on your system. Then, run the following command to install the tool from crates.io: ``bash cargo install bitmap_type_tracer --locked %%CODEBLOCK0%%bash bitmap_type_tracer <path_to_font_image> <sequence> <text> <chars_per_row> [--top VALUE] [--bottom VALUE] [--left VALUE] [--right VALUE] [--threshold VALUE] [--save-json] %%CODEBLOCK1%%bash bitmap_type_tracer "examples/4138906397_0dc616813b_o.png" " !\" '()*+,-.\\0123456789:; = ? ABCDEFGHIJKLMNOPQRSTUVWXYZ " "Bitmap Type Tracer" 10 --threshold 1 --save-json %%CODEBLOCK2%%bash bitmap_type_tracer <path_to_font_image> <text> %%CODEBLOCK3%%bash bitmap_type_tracer "examples/4138906397_0dc616813b_o.png" "Bitmap Type Trace" %%CODEBLOCK4%%bash bitmap_type_tracer examples/4138906397_0dc616813b_o.png " \!\" '()*+,-.\\0123456789:; = ? ABCDEFGHIJKLMNOPQRSTUVWXYZ " tolik518 10 %%CODEBLOCK5%%bash bitmap_type_tracer examples/4138906425_29cbc92641_o.png " \!\" '()*+,-.\\0123456789:; = ? ABCDEFGHIJKLMNOPQRSTUVWXYZ " tolik518 10 %%CODEBLOCK6%%bash bitmap_type_tracer examples/FONT34.png " \! () , . 0123456789:; - ? ABCDEFGHIJKLMNOPQRSTUVWXYZ " tolik518 20 --bottom 150 --threshold 20 %%CODEBLOCK7%%bash bitmap_type_tracer examples/font228.png "ABCDEFGHIJKLMNOPQRSTUVWXYZ>.: " tolik518 10 --threshold 0 ` 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. The background was not recognized properly, so it was filled with the brown instead of black. ![](examples/outputs/font228.png_tolik518.png) --------------------------------------- _/examples/font239r.png_ ![](./examples/font239r.png) `bash bitmap_type_tracer examples/font239r.png "ABCDEFGHIJKLMNOPQRSTUVWXYZ()\!?.,โ€™ " tolik518 7 --bottom 4 --threshold 1 %%CODEBLOCK8%%bash bitmap_type_tracer examples/font244r.png "ALW6BMX7CNY8DOZ9EP*\!FQ0?GR1.HS2 IT3 JU4 KV5 " tolik518 4 --threshold 30 `` We needed a threshold of 30 to remove the black background.


/examples/font248r.png
bitmap_type_tracer examples/font248r.png "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 \!?." tolik518 20 --threshold 60
To have a better result, we needed a threshold of 60 to remove the black background.


/examples/MEGAD.png
bitmap_type_tracer examples/MEGAD.png "'() +,-. 0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ     ! =?     " tolik518 10 --bottom 10 --threshold 1
In this example, we needed to add a bottom margin of 10 for the characters to align properly.


/examples/MEGAD2.png
bitmap_type_tracer examples/MEGAD2.png "AGMSY+:4BHNTZ\!;5CIOU.?06DJPV;(17EKQW\")28FLRX-'39" tolik518 8 --bottom 3 --threshold 1

Contributions

Feel free to contribute by opening issues or pull requests. All feedback is welcome!

Rust love