Nodes/ComfyUI_KubaNodes/kubakub mosaic illusion
ComfyUI Node

kubakub mosaic illusion

Cuts a texture photo into mosaic tiles and picks or shades each tile so a target picture appears when seen from a distance. The tiles stay real material; strength sets how readable the hidden picture is.

By kubakubkub·Created 15 days ago·Updated 3 days ago· 9
kubakub mosaic illusion
  • texture
  • target
  • image
  • tile_values
  • grid
◄tile_px48►
◄strength0.55►
◄modeselect►
◄quantise_texturetrue►
◄target_fitcover►
◄target_autocroptrue►
◄target_autolevelstrue►
◄target_blur6►
◄target_invertfalse►
◄contrast1.20►
◄adaptivefalse►
◄min_tile_px8►
◄detail0.060►
◄max_depth3►
◄edge_noise0.00►
◄edge_scale12►
◄mortar0.00►
◄mortar_value0.00►
◄jitter0.00►
◄palette_size12►
◄dither0.90►
◄level_radius6►
◄seed0►
Categorykubakub/lab/mosaic

Inputs (25)

NameTypeDefaultDescription
textureIMAGEThe material photo (stone, tiles, bricks) the mosaic is cut from. Sets the output size; a batch gives one mosaic per image.
targetIMAGEThe picture hidden in the mosaic. Only its brightness is used (first image of a batch).
tile_pxINT482–2048Tile size in pixels. With adaptive on this is the largest tile.
strengthFLOAT0.550–10 = material only, 1 = target fully readable. Animate to move the resolving distance.
modeCOMBOselectselect picks the tile from the material's own palette whose value the picture needs, the way a mosaicist picks from a tray. Nothing is tinted. multiply darkens / brightens the tiles, mix blends them toward the target grey, lift only brightens where the target is light.
quantise_textureBOOLEANtrueFlatten each tile to one colour. Turn off when the texture is already tiled.
target_fitoptCOMBOcoverHow the target fits the texture size. cover fills and crops, contain fits it whole on mid grey, stretch distorts it to fit.
target_autocropoptBOOLEANtrueTrim a dark border so a cutout fills the frame.
target_autolevelsoptBOOLEANtrueStretch the target's levels to full black to white, so a flat photo still reads.
target_bluroptINT60–200Soften the target so it emerges instead of stamping a silhouette.
target_invertoptBOOLEANfalseSwap light and dark in the target.
contrastoptFLOAT1.200–4Contrast of the target around mid grey. 1 = unchanged, higher makes the hidden picture punchier.
adaptiveoptBOOLEANfalseSplit tiles where the motif has detail, keep them large where it is flat.
min_tile_pxoptINT82–512adaptive only. Smallest tile in pixels; a tile is not split below this.
detailoptFLOAT0.0600.005–0.5adaptive only. How much the motif must change inside a tile before it is split. Lower splits more.
max_depthoptINT30–6adaptive only. How many times a tile may be halved (3 = down to 1/8 of tile_px).
edge_noiseoptFLOAT0.000–0.6Roughness of the tile outlines, as a fraction of tile size. 0.10 to 0.20 looks hand cut.
edge_scaleoptFLOAT122–200Noise wavelength in pixels. Small is jagged and chipped, large is wobbly.
mortaroptFLOAT0.000–0.45Width of the joints between tiles, as a fraction of tile size. 0 = no joints.
mortar_valueoptFLOAT0.000–1Grey level of the joints: 0 = black, 1 = white.
jitteroptFLOAT0.000–0.5Random change of each tile's target value, so the hidden picture looks less mechanical. 0 = off.
palette_sizeoptINT122–64select mode. How many tile colours are in the tray. Taken from the texture itself.
ditheroptFLOAT0.900–3select mode. Breaks banding at the edges of the hidden shape.
level_radiusoptFLOAT61–80select mode. Neighbourhood, in tiles, whose level gets shifted. Larger keeps more of the pattern.
seedoptINT00–4294967295Random seed for jitter, edge noise and dither. Same seed = same mosaic.

Outputs (3)

NameTypeDescription
imageIMAGEThe mosaic.
tile_valuesIMAGEThe grey value each tile was asked for (the target as the tiles see it).
gridIMAGEThe tile outlines: white tiles, black borders.