Menu
A landscape photo rendered as pointillism: a field of small non-overlapping coloured dots that resolve into a scene

Pointillize — a Photo-to-Dots Filter

A short Python 3 + OpenCV script that turns a photo into a pointillism-style image — a scatter of non-overlapping coloured dots, each sampled from the source.

The source photo: a landscape scene

The same scene rebuilt from hundreds of small non-overlapping coloured dots

Source photo and the pointillized output (radius 6).

How It Works

The output starts as a white canvas and gains one dot at a time:

  1. Pick a random pixel (row, col) in the source.
  2. Sample its colour.
  3. Try to stamp a filled circle of the chosen radius there.
  4. Keep it only if it does not touch any dot already placed.
  5. Repeat for a set number of attempts.

The collision test is the neat part: instead of comparing pixel lists, the candidate circle's mask is XOR‑ed against a running mask of every dot placed so far, using the candidate itself as the operation mask. If the result still equals the candidate mask, nothing overlapped and the dot is accepted.

Because circles can never overlap, the canvas saturates and later attempts are mostly rejected — the dot density plateaus on its own, which is what gives the hand‑stippled look rather than a solid mosaic.

Usage

python3 pointillize.py --image ./images/01.jpg --radius 10 --cycles 20 --debug True
FlagMeaning
--imagepath to the source image
--radiusdot radius, pixels
--cyclesnumber of placement attempts (not dots placed)
--debugTrue / False

Needs Python 3, opencv-python and numpy; the result is written to resultado.png.

Another Example

A portrait photo

The portrait rendered as fine coloured stippling

A portrait at a small radius — the effect becomes a fine grain.

Notes

  • With a small radius you need tens of thousands of attempts to cover a photo, since --cycles counts tries, not hits.
  • An earlier per‑pixel collision function is still in the file but unused — the mask‑XOR approach replaced it.
Posted In:
Computer Vision