Expand description
§Geometrize
Transform images into geometric art.
This crate provides two rendering styles:
- Low-poly: Decomposes an image into colored triangles via Delaunay triangulation.
- Pointillist: Renders the same triangulation as overlapping circles.
§Quick Start
Images are transformed using the geometrize function.
use geometrize::{geometrize, Style, SamplingParams};
use image::{open, RgbaImage};
let image = open("launch.jpg").unwrap();
let lowpoly: RgbaImage = geometrize(
&image,
Style::Lowpoly,
70_000,
SamplingParams::default()
).unwrap();
lowpoly.save("lowpoly_70k.png").unwrap();
let pointillist: RgbaImage = geometrize(
&image,
Style::Pointillist {noise: 0.0},
20_000,
SamplingParams::default()
).unwrap();
pointillist.save("pointillist_20k.png").unwrap();
§Transparent images
This also works with transparent images.
let image = open("dice.png").unwrap();
let lowpoly: RgbaImage = geometrize(
&image,
Style::Lowpoly,
50_000,
SamplingParams::default()
).unwrap();
lowpoly.save("lowpoly_50k_dice.png").unwrap();
let pointillist: RgbaImage = geometrize(
&image,
Style::Pointillist {noise: 0.0},
10_000,
SamplingParams::default()
).unwrap();
pointillist.save("pointillist_10k_dice.png").unwrap();
Structs§
- Sampling
Params - Parameters controlling how sample points are chosen from the image.
Enums§
- Edge
Points - Controls how many sample points are placed along the image border.
- Geometrize
Error - Error type for
geometrize. - Sample
Seed - Source of randomness for point sampling.
- Style
- The visual style used to render the output image.
Functions§
- geometrize
- Convert an image into geometric art.
- seed_
from_ image - Derive a seed from the content of an image.