diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2019-12-02 14:27:21 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-02 14:27:21 +0000 |
| commit | 105bf67434a5e327360226a8a75cd8080d8ce8b0 (patch) | |
| tree | 75e6ad49054d5b2fbedc9b4d53fa86ce6c57b97d /README.md | |
| parent | 2063ef42fc0ec2f729217af25a9504c820a5cb63 (diff) | |
| download | distill-105bf67434a5e327360226a8a75cd8080d8ce8b0.tar.xz distill-105bf67434a5e327360226a8a75cd8080d8ce8b0.zip | |
Update README.md
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 44 |
1 files changed, 43 insertions, 1 deletions
@@ -1 +1,43 @@ -# distill
\ No newline at end of file +# distill + +`distill` is a small go program which takes an image and redraws a primitive version using only extremely simplified shape and colour informaion. It's designed to be run against artistic works (e.g. paintings) but works with any image. + +While the output is basic, `distill` tries to generate recognisable images which retain the character and substance of the original. Whether it succeeds at this or not is up to you. + +## Running +Download a binary release (todo) or fetch the package +``` +go get github.com/jamesbarnett91/distill +``` +Then invoke `distill` passing an image e.g. `distill some-magnum-opus.png` + +`distill` takes the follwing optoins which can be used to adjust the output: +``` +Usage: + distill [OPTIONS] [file] + +Application Options: + -b, --block-size= The size of the blocks the image should be distilled to. E.g. 10 will result in square blocks of 10x10 pixels. Note + that this is the size of the blocks, not the number of blocks. (default: 50) + -n, --max-dominant-colours= The number of dominant colours to be extracted from the image. (default: 8) + -o, --output-path= Path to the output file. The format will be png. (default: out.png) + +Help Options: + -h, --help Show this help message + +``` + + +## Procedure +The distillation process has 4 steps. +#### 1. Extract dominant colours +The n most dominant colours are extracted from the image. This is done via a [k-means clustering](https://en.wikipedia.org/wiki/K-means_clustering). +#### 2. Divide into blocks +The image is divided into square blocks of size b. This has the effect of drastically 'enlarging' the pixels. +#### 3. Average the colour in each block +The average colour of each block is calculated. This creates an extremely low resolution version of the original (while preserving the size) +#### 4. Set each block to the closest dominant colour +The average colour of each block is compared to the previously extracted dominant colours. The block colour is set the the closest dominant colour based on its [euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) in the [Lab](https://en.wikipedia.org/wiki/CIELAB_color_space) colour space. + +## Samples +TODO |