📐 Convert images to Low-Poly art using Delaunay triangulation.
You need Python 3.10 or higher.
I strongly recommend to use virtual environment such as Anaconda. You can download Anaconda here.
Follow manual below to create conda virtual environment for Triangler with the Anaconda.
$ conda create -n triangler python=3.12
$ activate triangler
(triangler)$ python -m pip install git+https://github.com/tdh8316/triangler/
(triangler)$ python -m triangler -h
positional arguments:
input Input image
options:
-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
You can also use Triangler as a library.
import triangler
triangler.convert(
img="INPUT_IMAGE.jpg",
save_path="OUTPUT_IMAGE.jpg",
)
Original Image | 5000 Points |
---|---|
1000 Points | 500 Points |
Original | Triangler |
---|---|
Licensed under the MIT License.
Copyright 2024 Donghyeok Tak
Some algorithms, including the Poisson disk sampling, are based on pmaldonado/PyTri.