https://github.com/anthonynguyen/primitive
Approximates images by drawing random lines
https://github.com/anthonynguyen/primitive
approximation image rust
Last synced: 11 months ago
JSON representation
Approximates images by drawing random lines
- Host: GitHub
- URL: https://github.com/anthonynguyen/primitive
- Owner: anthonynguyen
- License: mit
- Created: 2017-10-13T16:31:43.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-18T03:55:21.000Z (over 8 years ago)
- Last Synced: 2025-03-11T06:57:17.769Z (11 months ago)
- Topics: approximation, image, rust
- Language: Rust
- Homepage: https://crates.io/crates/primitive
- Size: 3.02 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `primitive`
[![primitive on Travis CI][travis-image]][travis]
[![primitive on crates.io][cratesio-image]][cratesio]
[![primitive license][license-image]][license]
[travis-image]: https://travis-ci.org/anthonynguyen/primitive.svg?branch=master
[travis]: https://travis-ci.org/anthonynguyen/primitive
[cratesio-image]: https://img.shields.io/crates/v/primitive.svg
[cratesio]: https://crates.io/crates/primitive
[license-image]: https://img.shields.io/github/license/anthonynguyen/primitive.svg
[license]: https://github.com/anthonynguyen/primitive/blob/master/LICENSE
primitive is a Rust program that approximates images by drawing random lines.
## Installing
Assuming you have Rust installed, run
```
cargo install primitive
```
Alternatively, you can run it from the source directory with
```
cargo run --release -- ...OPTIONS...
```
## Samples
**********
[Source](https://www.pexels.com/photo/high-angle-view-of-cityscape-against-cloudy-sky-313782/)


```
primitive -i sample/sample1_input.png -o sample/sample1_output.png -n 10000000 -l 10
```
**********
[Source](https://www.pexels.com/photo/autumn-daylight-fall-fog-589841/)


```
primitive -i sample/sample2_input.png -o sample/sample2_output.png -n 1000000 -l 40 --min-angle 20 --max-angle 60
```
## Usage
```
primitive 0.1.0
Anthony Nguyen
USAGE:
primitive [OPTIONS] --input [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-i, --input Input filename
-n, --iterations Number of iterations to run [default: 1000000]
-l, --line-length The length (in pixels) of the lines to draw [default: 25]
--max-angle The maximum angle (in degrees) to generate [default: 360]
--min-angle The minimum angle (in degrees) to generate [default: 0]
-o, --output Output filename
SUBCOMMANDS:
bench Runs in benchmark mode
help Prints this message or the help of the given subcommand(s)
```
## License
`primitive` is licensed under the MIT license. Please see the `LICENSE` file for
more details.