2 releases
0.1.1 | May 28, 2021 |
---|---|
0.1.0 | May 28, 2021 |
#7 in #grids
83KB
155 lines
img2yaya - generate yayagram files from images
Yayagram is a super neat nonogram puzzle game for the terminal. It either generates random grids or loads predefined grids from a file. It even features an editor to easily create your own grids. But let's be honest, creating grids isn't as much fun as playing them.
This is where img2yaya becomes handy. It automatically generates grids from images with the desired dimensions in just a couple of seconds.
Installation
cargo install img2yaya
Usage
- Print help
img2yaya --help
- Read image and output yayagram to stdout
img2yaya input.png
- Read image and output yayagram to file
img2yaya input.png output.yaya
- Additionally set threshold for filling cells to 50 (0-255), invert colors and set grid width to 20
img2yaya input.png output.yaya -t 50 -i -w 20
Example grids
Examples of grids generated by img2yaya can be found in the examples folder. Images of those examples loaded and solved in yayagram can be found in the images folder.
If you have a nice grid you'd like to share please open up a pull request to merge this grid into this repository!
Limitations
img2yaya uses a grayscale format to determine which fields to fill and which not and is therefore not aware of colors. For now the grids are primarily made for playing as a puzzle so other fill types such as "maybe" are not used to represent the color of the image more accurately.
Too much detail in images will likely cause problems due to the limited amount of pixels available on a grid and large grids (over about 20x20) become very hard to play. Therefore simple images with few colors will have the best results.
Varying the threshold can yield much better results.
Dependencies
~6.5MB
~82K SLoC