Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spcbfr/ascii-go
A script that converts images to ascii art
https://github.com/spcbfr/ascii-go
Last synced: 12 days ago
JSON representation
A script that converts images to ascii art
- Host: GitHub
- URL: https://github.com/spcbfr/ascii-go
- Owner: spcbfr
- License: mit
- Created: 2024-03-02T20:17:49.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-09T14:13:52.000Z (8 months ago)
- Last Synced: 2024-06-21T08:24:37.079Z (5 months ago)
- Language: Go
- Homepage:
- Size: 47.9 KB
- Stars: 24
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ascii-go
I started learning golang last week (February 2024), and this is my first project using it.the program takes a PNG image and converts it to ascii art.
## How does it work?
First I split the image into pixels, each pixel has an RGB value. I use the RGB value to determine the brightness of a each pixel. finally I map the brightness to a character from an ascii character set and output the result to a file
Here is what the output looks like (this is k9 from doctor who!)
## How to use
1. Install [golang](https://go.dev/doc/install)
2. clone the project `git clone https://github.com/spcbfr/ascii-go.git`
3. run `go build .`
4. run `./ascii-go` (`ascii-go.exe` if you're on windows) you should see the usage instructionsThe result is best viewed with a zoomed-out text editor with no-syntax highlighting, a low line-height improves the effect further too.
**Note:** if the output doesn't look totally right, try using the `--invert` flag. this uses denser characters for lower brightness pixels and vice-versa
Happy Ascii-ing!
## To work on
- [ ] support Image formats other than PNG
- [x] better brightness calculation algorithm
- [ ] pull image from remote source
- [ ] reduce image size for images larger than a certain size