Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kpouer/image2text
https://github.com/kpouer/image2text
ascii-art cli image image-processing rust rust-lang
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/kpouer/image2text
- Owner: kpouer
- License: mit
- Created: 2023-07-30T16:10:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-24T18:38:53.000Z (5 months ago)
- Last Synced: 2024-10-31T11:46:58.350Z (about 2 months ago)
- Topics: ascii-art, cli, image, image-processing, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 2.48 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# image2text
An image converter that will convert an image to an ascii images.
It can work in black & white or color.## Usage
```
Usage: image2text [OPTIONS] [FILE]
convert an image to ascii art-f, --file the image filename you want to conver
-h, --height the height of the output ascii art
-w, --width the width of the output ascii art
-c, --color the color mode of the output ascii art (bw, ansi or truecolor)
-i, --inverted Invert the pixels
-p, --pixel the pixel mode of the output ascii art (ascii, ascii2 or unicode)
-cp, --custom-pixel the custom pixel of the output ascii art
-cr, --char-size-ratio the char size ratio of the output ascii art
```
### height & widthYou can specify the height and/or width of the output ascii art.
If you don't specify them, the program will use original size of the image
with one character per pixel.
If you only specify one of them, the program will keep the ratio of the image and use the char size ratio.### char size ratio
Because pixels are square, but characters are not, you can choose a ratio between width and height of the characters.
By default, the program will use a ratio of 2.05. You can choose another ratio by using the "-cr" option.### color
By default, the program will use the color mode "ansi" with 256 colors.
It can also use black & white mode or even truecolor if your terminal supports 24bits color.
It is also possible to choose a background color.### background color
You can choose a background color by using the "-bg" option.
The color codes are ansi color codes. You can find them here: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors### Inverted
You can choose to invert the image. In that case the character density will inverted.
## Examples
```bash
image2text -f example/simpsons.jpg
```![simpsons](example/simpsons_color.png)
```bash
image2text -i -c bw -f example/simpsons.jpg
```
![simpsons](example/simpsons_bw.png)```bash
image2text -bg 40 -f example/simpsons.jpg
```
![simpsons](example/simpsons_color_black_bg.png)## Licence
The project is released under MIT licence
## Dependencies
This project depends on
- image (https://crates.io/crates/image)
- rgb2ansi256 (https://crates.io/crates/rgb2ansi256)