Transform any image into a rich oil painting using frequency-based brushstroke logic. Adjust brush size, boost color saturation, and emulate traditional canvas art — all locally in your browser.
Our engine mimics traditional oil painting through a dominant-color brushstroke algorithm (local mode filter). Unlike generic filters that blur or pixelate, this method preserves strong edges while replacing local color variations with coherent color clusters — the result is a harmonious blend of photorealism and artistic abstraction, reminiscent of pointillist and expressionist techniques.
? Core algorithm: sliding window color majority
For each pixel (x,y), we examine a square neighborhood of size s (brush diameter). The most frequent color (mode) inside that window replaces the original pixel. This creates clustered paint dabs that emulate thick oil strokes while preserving major contours. Mathematically:
H(x,y) = Mode{ C(i,j) | |i-x| ≤ r, |j-y| ≤ r } where r = brushRadius.
Oil painting has shaped Western art for centuries, from the Flemish Primitives to Van Gogh’s impasto. Our digital simulation respects two key properties: chromatic consolidation (reducing noise into coherent color patches) and edge preservation (contours remain sharp, emulating brush direction changes). The adjustable brush size lets users simulate fine detail work (small brushes) or broad expressive passages (large palette knife).
Imagine uploading an old photograph — with brush size 7 and vivid mode enabled, the output shows distinct brush-like clusters in the skin tones and clothing, while facial features remain recognizable. This is ideal for creating personalized gifts, social media art, or print-ready posters. The non‑destructive local processing gives you full creative control without sending data to any external server.
The mode filter is a well‑known edge‑preserving smoothing technique used in non‑photorealistic rendering (NPR). Unlike mean or Gaussian blur, which destroy edges, the mode filter retains strong boundaries because neighboring regions with different dominant colors stay distinct. This property is what authentically replicates the look of oil painting. Our implementation is pure JavaScript + Canvas 2D API, with no external libraries or AI models. Processing time for an 800×600 image with brush size 9 is typically < 1 second on modern devices.
| Brush size range | Visual effect | Best for |
|---|---|---|
| 3–5 | Fine grain, almost pointillist | Portraits, detailed illustrations |
| 7–9 | Classic oil brush, visible strokes | Landscapes, still life, general photos |
| 11–15 | Heavy impasto, abstract clusters | Expressionist art, high-impact posters |
Average blur (mean filter) produces muddy, plastic-like results because it blends contrasting colors. Mode filtering selects the most frequent color, effectively “voting” for the dominant hue. This preserves edges (adjacent areas with different dominant colors remain distinct) and generates the characteristic broken color effect of impressionist and post‑impressionist paintings. The optional vivid mode applies a post‑processing saturation enhancement using a simple gamma‑adjusted HSV scaling — a common and transparent technique to boost perceived color richness without over‑saturation artifacts.