Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxhalford/carre
:ok_hand: Image simplifier
https://github.com/maxhalford/carre
golang image-processing
Last synced: 3 months ago
JSON representation
:ok_hand: Image simplifier
- Host: GitHub
- URL: https://github.com/maxhalford/carre
- Owner: MaxHalford
- License: mit
- Created: 2017-05-01T00:40:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-11T13:50:18.000Z (over 7 years ago)
- Last Synced: 2024-10-08T10:47:44.206Z (3 months ago)
- Topics: golang, image-processing
- Language: Go
- Homepage:
- Size: 1.44 MB
- Stars: 33
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# carre
This is the implementation of a very algorithm for "simplifying" images. The idea is that patches of a single can carry the same visual information with less detail; this results in images that are easier to compress and look a bit like cubism. The algorithm goes as follows:
1. Calculate the average color of the initial image
2. Calculate the average color difference from the average calculated in step 1
3. If the average color difference higher than some threshold, split the image in 4 and apply step 1 to each sub-image
4. If not then color a new blank image with the average color obtained in step 1 and the boundaries of the current imageThe algorithm is recursive and deterministic. Lowering the threshold will result in images with more detail, indeed if the threshold is 0 then the algorithm reproduces the original image.
## Installation
1. [Install Go](https://golang.org/doc/install)
2. Make sure that `$GOPATH` is set and that `$GOPATH/bin` has been added to the global path
3. Run `go get -u github.com/MaxHalford/carre`
4. Run `carre -help` to check that the installation was successful## Examples
```sh
carre -in original/rousseau-1.jpg -out processed/rousseau-1.png -threshold 15
```Original | Processed
:-------------------------:|:-------------------------:
![rousseau-1-original](original/rousseau-1.jpg) | ![rousseau-1-processed](processed/rousseau-1.png)```sh
carre -in original/rousseau-2.jpg -out processed/rousseau-2.png -threshold 10
```Original | Processed
:-------------------------:|:-------------------------:
![rousseau-2-original](original/rousseau-2.jpg) | ![rousseau-2-processed](processed/rousseau-2.png)```sh
carre -in original/rousseau-2.jpg -out processed/rousseau-3.png -threshold 30
```Original | Processed
:-------------------------:|:-------------------------:
![rousseau-3-original](original/rousseau-3.jpg) | ![rousseau-3-processed](processed/rousseau-3.png)## Usage
Run `carre -h` to get a list of available parameters.
## License
The MIT License (MIT). Please see the [license file](LICENSE) for more information.