Petrelic

Home / About / Algorithm lab

Perler Bead Image Algorithm Lab

Turning a photo into squares is only the first step. A buildable pattern depends on how each cell is sampled, how colors map to a real bead palette, whether edges turn gray and whether small facial features survive cleanup.

Test version: July 27, 2026 · MARD 221 base palette

Case study: simplify complex artwork before conversion

Both panels use the same internal test image. The left image is the simplified illustration; the right image is a 420 x 420 digital bead simulation used to inspect outlines, color blocks and grid distribution. It is not a photograph of a fused physical piece.

Three-character chibi illustration used as the algorithm input
Input: a full-body three-character chibi illustration with clothing texture, skin transitions and small hand details.
Digital Perler bead simulation of the three-character illustration
Output: a digital bead simulation that preserves hair, clothing colors and relationships while removing fabric texture and tiny decoration.

A multi-person full-body image still needs many beads after simplification. To stay under about 10,000 beads, crop unused space first and choose the grid width according to the number of subjects. A single portrait usually preserves facial features more reliably.

Test 1: use the mode color, not the average

When an image is reduced, one target cell may cover an outline, skin and background. Averaging those pixels creates a gray edge. Selecting the most frequent valid color usually keeps illustrated shapes cleaner.

Target cell color = most frequent valid color in the sampled region
Average color is reserved for continuous-photo treatment, not the default for illustrated outlines.

Mode sampling is not sufficient by itself. An eye, mouth corner or earring may occupy less area than the surrounding skin, so a separate feature-protection pass is still required.

Test 2: RGB distance versus CIEDE2000

For each target color below, the nearest MARD 221 base color was calculated with both RGB Euclidean distance and CIEDE2000 perceptual difference. The results come from the current site palette and can be reproduced after palette updates.

Target screen colorNearest RGBNearest CIEDE2000Observation
#B98972M8M13Warm skin: Lab avoids a gray-purple match.
#4C7F83B25M3Muted cyan: RGB appears greener; Lab stays low-saturation.
#485A92C29D3Blue-violet: the metrics weight hue differently.
#E2C8A5G11G16Light beige: Lab better reflects perceived lightness.

Screen HEX values are algorithm references. Physical beads still vary with the display, lighting and production batch. For a large project, verify skin tones, grays and adjacent light colors against a physical chart.

Test 3: protect outlines and facial features

Forcing every dark color to black can merge hair, eyes and the outer contour. Aggressive speck removal can also delete a one-cell eye. The current method separates the two cases:

  1. Only the contour touching transparent background is pushed toward the darkest color.
  2. Small dark areas inside skin regions enter a protected facial-feature mask instead of being deleted as noise.
  3. The editor remains available when the automatic result cannot reliably decide which cells matter.

Current conclusions and open work

  • Verified: mode-color sampling reduces gray illustrated edges; CIEDE2000 selects different palette colors for some skin, muted cyan and blue-violet targets; feature protection prevents small facial details from disappearing.
  • Not claimed: a digital simulation does not reproduce the exact color of fused physical beads and cannot replace batch, lighting and board-size testing.
  • Next: collect authorized four-stage examples showing source, chart, bead placement and finished piece, including bead count, making time and manually corrected cells.