https://github.com/tdh8316/triangler
:triangular_ruler: Convert images to Low-Poly art using Delaunay triangulation.
https://github.com/tdh8316/triangler
delaunay delaunay-triangulation image-processing numba numpy python triangulation
Last synced: about 1 month ago
JSON representation
:triangular_ruler: Convert images to Low-Poly art using Delaunay triangulation.
- Host: GitHub
- URL: https://github.com/tdh8316/triangler
- Owner: tdh8316
- License: mit
- Created: 2020-02-15T14:26:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-05T13:45:49.000Z (over 1 year ago)
- Last Synced: 2025-09-08T05:02:52.366Z (about 1 month ago)
- Topics: delaunay, delaunay-triangulation, image-processing, numba, numpy, python, triangulation
- Language: Python
- Homepage:
- Size: 25.5 MB
- Stars: 97
- Watchers: 2
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://www.python.org/downloads/)
[](https://github.com/psf/black)
[](https://opensource.org/licenses/MIT)
[](https://github.com/tdh8316/triangler/stargazers)
[](https://twitter.com/intent/tweet?text=Convert%20images%20to%20Low-Poly%20art:&url=https%3A%2F%2Fgithub.com%2Ftdh8316%2Ftriangler)# Overview
📐 Convert images to Low-Poly art using [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation).

## Table of contents
1. [Installation](#installation)
2. [Usage](#usage)
3. [Use as a library](#api)
4. [Sample](#sample)
5. [License](#license)## Installation
You need [Python](https://www.python.org/) 3.10 or higher.
I strongly recommend to use virtual environment such as Anaconda.
You can [download Anaconda here](https://www.anaconda.com/distribution/#download-section).Follow manual below to create conda virtual environment for Triangler with the Anaconda.
```cmd
$ conda create -n triangler python=3.12
$ activate triangler
(triangler)$ python -m pip install git+https://github.com/tdh8316/triangler/
```## Usage
```
(triangler)$ python -m triangler -h
positional arguments:
input Input imageoptions:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
Output image name
-p POINTS, --points POINTS
Number of sample points to use
-e {canny,entropy,sobel}, --edge-detector {canny,entropy,sobel}
Edge detection algorithm
-s {poisson_disk,threshold}, --sampler {poisson_disk,threshold}
Point sampling algorithm
-r {centroid,mean}, --renderer {centroid,mean}
Color polygon rendering algorithm
-l, --reduce Reduce the result image size to match the input image
-V, --version show program's version number and exit
-d, --debug Enable debug mode
```## API
You can also use Triangler as a library.
```python
import trianglertriangler.convert(
img="INPUT_IMAGE.jpg",
save_path="OUTPUT_IMAGE.jpg",
)
```## Sample
### Effect of the number of points
| Original Image | 5000 Points |
|:--------------------------------------------:|:--------------------------------------------:|
|  |  |
| **1000 Points** | **500 Points** |
|  |  |### More samples
| Original | Triangler |
|-----------------------------|---------------------------------------|
|  |  |## License
Licensed under the MIT License.
Copyright 2024 `Donghyeok Tak`
## Credits
Some algorithms, including the Poisson disk sampling, are based
on [pmaldonado/PyTri](https://github.com/pmaldonado/PyTri).