Image Trace: Noise leaves cut-edge blends out of a speck's color

When Noise picks the nearest color for a speck, the speck's average now
leaves out the semi-transparent pixels along a cut-out image's edge that
are the color beside them blended with the transparent background.
settle_cut_edges returns which pixels those are. A speck made only of
them merges by border. In Grayscale the speck's gray is read with luma,
the gray Grayscale traces with, and the test probe shift_probe denoises
as a trace does.

The docs now say the rule applies in Color and Grayscale (in Black and
White a region has only one neighboring color, so Black and White Logo
changes only by its Noise value), name `ea3f81d9c3` as the base of the
measurements, and say that the gradient-border test sets Noise 15
because at Noise 8 its borders stray 0.92 px against a 0.9 px limit.
This commit is contained in:
dotCooCoo
2026-11-15 09:01:14 -08:00
parent e02faf2293
commit 3dad1013a4
8 changed files with 130 additions and 47 deletions
+23 -14
View File
@@ -317,15 +317,20 @@ A region below Noise used to join the color it shares the longest border with. A
line on a light ground, a dark speck of the line touches the ground on more sides than the line, so
it joined the ground and the line broke into dashes. Now, when the color of the longest border is
10 or more apart from the region's own color (Oklab × 100), the region joins the neighboring color
nearest the average of its source pixels, among the colors that share at least a tenth of the
longest border. A single pixel whose longest border is tied between colors joins by border as
before, so an anti-aliased corner pixel stays with the shape's corner. The rule changes only which
color a region joins, and higher Noise still continues the same merge sequence. The values are
nearest the average of its pixels, among the colors that share at least a tenth of the longest
border. The average is taken in the image as prepared for tracing (deblocked, and smoothed for a
photo) and leaves out the semi-transparent pixels along a cut-out image's edge that are the color
beside them blended with the transparent background. A single pixel whose longest border is tied
between colors keeps the previous rule. The rule changes only which
color a region joins, and higher Noise still continues the same merge sequence. It applies in Color
and Grayscale: in Black and White a region has only one neighboring color. The values are
VectorCraft's own. 6 Colors and 16 Colors move from Noise 15 to 8, and Black and White Logo from 25 to 5.
The new Noise values were chosen with the rule in place, and the measurements below include both
changes.
Measured on 17 local images (synthetic shapes and photos at several sizes, a geometric drawing and
eight illustrations; not repository assets), against the same `main` without the change, with the
mean absolute difference per channel (0 to 255) against the image on white:
eight illustrations; not repository assets), against `main` at `ea3f81d9c3`, with the mean absolute
difference per channel (0 to 255) against the image on white:
| preset | three illustrations with fine dark lines | four other illustrations | synthetic shapes and photos |
|:--|:--|:--|:--|
@@ -333,15 +338,19 @@ mean absolute difference per channel (0 to 255) against the image on white:
| 6 Colors | 7.24 / 9.14 / 9.21 → 5.87 / 6.66 / 7.87; anchors +55% to +73% | −0.6% to −3.5%; anchors +13% to +20% | within 0.03; anchors 0% to +22% |
| High Fidelity Photo | 8.42 / 10.11 / 7.46 → 6.85 / 7.54 / 6.00; anchors +31% to +51% | −1.4% to −5.8%; anchors −9% to +4% | within 0.08; anchors −6% to +5% |
Black and White Logo's pixels that differ from the image thresholded at 128 fall from 2.00 / 2.42 /
1.96% to 1.49 / 1.58 / 1.23% on the three illustrations and from 1.19 to 2.37% to 1.14 to 1.94% on the
other four, with 5% to 64% more anchors; the synthetic inputs change by 0.01% or less. A simple flat
illustration changes by 1.1% or less in every preset, and the geometric drawing keeps its anchor
count and difference in every preset. Tests: `a_dark_speck_beside_a_dark_line_joins_the_line`,
`a_speck_close_to_its_longest_border_color_joins_it`, `a_color_with_a_short_border_is_not_chosen`,
`a_lone_pixel_tied_between_colors_merges_by_border`, `noise_still_removes_every_region_below_it` and
With Black and White Logo, where only the Noise value changes, the pixels that differ from the image
thresholded at 128 fall from 2.00 / 2.42 / 1.96% to 1.49 / 1.58 / 1.23% on the three illustrations,
with 37% to 64% more anchors, and from 1.19 to 2.37% to 1.14 to 1.94% on the other four, with 5% to
41% more anchors; the synthetic inputs change by 0.01% or less. On a simple flat illustration the
difference changes by 1.0% or less in every preset, with up to 21% more anchors, and the geometric
drawing keeps its anchor count and difference in every preset. Tests:
`a_dark_speck_beside_a_dark_line_joins_the_line`, `a_speck_close_to_its_longest_border_color_joins_it`,
`a_color_with_a_short_border_is_not_chosen`, `a_lone_pixel_tied_between_colors_merges_by_border`,
`a_speck_of_settled_cut_edge_pixels_merges_by_border`, `noise_still_removes_every_region_below_it` and
`a_source_that_does_not_cover_the_labels_is_not_read` in `crates/trace/src/quantize/denoise.rs`.
`the_borders_of_a_gradients_bands_follow_its_contours` runs at Noise 15, the value it was written for.
`the_borders_of_a_gradients_bands_follow_its_contours` now traces at Noise 15: at 16 Colors' new
Noise 8 the borders of its noisy gradient stray 0.92 px from the contours, above the test's 0.9 px
limit.
## Pieces returning to a junction
An outline piece can return to its starting junction while being fitted as an open chain. At loose
+6 -3
View File
@@ -3849,9 +3849,12 @@ already walks Image Trace. Short agent entry points:
when nothing was traced.
`noise` (Color, Grayscale and Black and White, not Flat Logo) merges areas smaller than that many pixels into a
neighboring color. Each one joins the color it shares the longest border with, unless that color is 10 or more apart from its own (Oklab
× 100). Then it joins the neighboring color nearest the average of its source pixels, among the colors that share at
least a tenth of the longest border. A single pixel whose longest border is tied between two or more colors always
joins by border. These distances and fractions are VectorCraft's own values. The built-in presets 6 Colors and 16
× 100). Then it joins the neighboring color nearest the average of its pixels, among the colors that share at
least a tenth of the longest border. The average is taken in the image as prepared for tracing (deblocked, and
smoothed for a photo) and leaves out the semi-transparent pixels along a cut-out image's edge that are the color
beside them blended with the transparent background. A single pixel whose
longest border is tied between two or more colors always joins by border. In Black and White an area has only one
neighboring color. These distances and fractions are VectorCraft's own values. The built-in presets 6 Colors and 16
Colors use Noise 8, and Black and White Logo uses Noise 5.
`imageTrace.presets.save {name?, newName?, preset?, enhanced?, params?}` saves tracing settings as a preset kept with
the preferences: `params` over `preset`'s (default: the saved preset `name`, else Default), checked as `imageTrace.make`
File diff suppressed because one or more lines are too long