Overview
Introduction
This tool applies a real Voronoi diagram — a classic computational-geometry construction — to a PNG's pixels, entirely in your browser.
The result is a mosaic-like reinterpretation of the source image where each region takes its color from a single sampled point.
What Is PNG to Voronoi Diagram Converter?
A client-side PNG-to-Voronoi-diagram converter that scatters a set number of site points across the image using a seeded deterministic random generator, then assigns every pixel to its nearest site and colors it using the pixel sampled at that site's location.
An optional edge-drawing pass darkens boundary pixels between neighboring cells, making the underlying diagram structure visible rather than just producing a mosaic.
How PNG to Voronoi Diagram Converter Works
For a chosen cell count and seed, the tool generates that many pseudo-random (x, y) site positions within the image bounds using a small, fast, fully deterministic PRNG (mulberry32), so the same inputs always produce the same layout.
Every output pixel then finds its nearest site by brute-force distance comparison, is colored with the source image's pixel color at that site's coordinates, and — if edge drawing is enabled — is overridden to black when its right or bottom neighbor belongs to a different site's cell.
When To Use PNG to Voronoi Diagram Converter
Use it to create a stylized, low-poly-esque mosaic version of a photo or graphic for a background, thumbnail, or decorative asset.
It's also a fun way to visualize how Voronoi diagrams partition space, using a real image as the backdrop instead of abstract points.
Often used alongside PNG Rotator and PNG Dimensions Finder.
Features
Advantages
- Runs entirely client-side; your image never leaves the browser.
- Fully deterministic for a given seed, so results are reproducible rather than random every time.
- Optional edge outlining turns a simple color mosaic into a genuine, readable diagram.
Limitations
- The nearest-site search is brute-force, so processing time grows with width times height times cell count — very large images combined with high cell counts can take a while.
- Cell count is capped at 300 to keep processing times reasonable in the browser.
Examples
Best Practices & Notes
Best Practices
- Start with a lower cell count (20-60) for a clearly faceted look; higher counts approach the original image's detail.
- Keep edge drawing on if you want the result to read as a diagram rather than a blurry mosaic.
Developer Notes
The pure algorithm lives in a lib function operating on a plain PixelBuffer with no DOM dependency, using a seeded mulberry32 PRNG for reproducible site placement and a brute-force O(width x height x cellCount) nearest-neighbor search per pixel, which is simple, correct, and fast enough for typical tool-sized images and cell counts.
PNG to Voronoi Diagram Converter Use Cases
- Creating a stylized low-poly-style image effect
- Generating a reproducible, seed-controlled mosaic background
- Demonstrating Voronoi diagrams visually using a real photo
Common Mistakes
- Setting a very high cell count on a large image and expecting an instant result — processing time scales with both.
- Expecting two different seeds to produce the same layout — only an identical seed and cell count reproduce identical results.
Tips
- Try a few different seeds at the same cell count to quickly compare several distinct mosaic layouts.
- Turn edges off if you want a smoother, more painterly mosaic look instead of a diagram with visible borders.