Image Trace: Flat Logo traces blurred black edges beside gray without gray slivers

With a gray between black and white, an edge pixel of black on white
took the black-and-white blend only when one of its eight neighbors lay
past the gray on each side and the flat black and white areas lay nearer
than the flat gray. On an edge blurred by a pixel or more neither holds,
so gray slivers lined black shapes: a black disc beside a gray square on
white traced up to 35 gray paths at blurs of 1 to 3 pixels.

The check now walks from the pixel along the line between the two outer
colors, up to 5 steps each way, each step to the neighbor that lies
farthest toward one of them while the pixels keep getting darker (or
lighter). The blend of the outer two lies as near as the farther of
their flat areas, or as the larger of the two step counts to a pixel of
each outer color when that is smaller. The first step is the old
neighbor check. The same disc and square now trace with one gray path
at blurs of 1 to 2 pixels. At 3 pixels, with the colors named, a gray of
128 is one path, a gray of 200 leaves 4 slivers with no area, and a gray
of 230 leaves 8 slivers of up to 21 pixels (14 gray paths before).

On edges blurred by a pixel or more, gray near black loses pixels. A
soft-edged gray band up to 4 pixels wide along black traces as black
and white at blurs of 1.5 and 2 pixels, and one up to 3 pixels wide at
blurs of 1 and 3 pixels. A soft-edged gray stroke 2 pixels from black
can lose some or all of its gray, and one 4 pixels away a few pixels. A
soft-edged gray stroke running out of black, blurred by 1 or 1.5
pixels, loses 3 or 4 of the 16 pixels nearest black. Sharp-edged bands
and strokes keep their gray.

Docs: docs/image-trace-adjustments.md, docs/target-app-parity.md.
This commit is contained in:
dotCooCoo
2026-11-16 06:18:09 -08:00
parent d738e7f0c0
commit a1dac2c27f
4 changed files with 266 additions and 42 deletions
+26 -7
View File
@@ -118,13 +118,32 @@ transparent that has the largest share in the blend of them that comes closest t
**Flat Logo with a color between two others.** When a traced color lies between two others, as a gray
lies between black and white, an anti-aliased edge pixel between the outer two is also a blend of the
middle color and one of them. Flat Logo then reads the pixel as the blend of the colors that lie nearest
it in the flat areas within 6 pixels, when the pixel has a neighbor darker and a neighbor lighter than the
middle color, along the line between the other two. A black disc beside a gray square on white traces
with one gray shape, the square, and no gray slivers around the disc, when its edges are sharp or blurred
by up to about half a pixel. An edge blurred by a pixel or more can still leave gray slivers along the
disc, and so can an image with noise of a level or more in its pixels. A gray stroke two or three pixels
wide beside black has no darker pixel next to it and stays gray. A soft-edged gray stroke about two
middle color and one of them. Flat Logo then reads the pixel as a blend of the outer two when the pixel
lies on an edge between them and that blend lies nearer the pixel than the blend with the middle color.
The pixel lies on such an edge when, along the line between the outer two colors, it reaches a pixel
darker than the middle color in at most 5 steps, each to the neighbor that lies farthest toward the
darker color while the pixels keep getting darker, and reaches a pixel lighter than the middle color the
same way. A blend lies as near the pixel as the farther of its colors' nearest flat areas within 6
pixels. The blend of the outer two also lies as near as the larger of the two step counts to a pixel of
each outer color, when that number is smaller.
A black disc beside a gray square on white traces with one gray shape, the square, and no gray slivers
around the disc, when its edges are sharp or blurred by up to 2 pixels, with the colors found or named.
With the colors named and edges blurred by 3 pixels, a gray of 128 is still one shape, a gray of 200
leaves 4 slivers with no area, and a light gray (230) leaves 8 slivers of up to 21 pixels. An image with
noise of a level or more in its pixels can still leave gray slivers along the disc.
With sharp edges, a gray stroke two or three pixels wide beside black has no darker pixel next to it and
stays gray, and so does a gray band along black. On edges blurred by a pixel or more, gray near black
loses some of its pixels. A soft-edged gray band up to 4 pixels wide lying along black traces as black
and white at blurs of 1.5 and 2 pixels, and so does one up to 3 pixels wide at blurs of 1 and 3 pixels; a
wider band loses some of its pixels next to black, and one 8 pixels wide keeps at least half of its gray
at blurs of 1.5 and 2 pixels. A soft-edged gray stroke 2 pixels from black can lose some or all of its
gray, one 4 pixels from black loses a few pixels (a light gray stroke 2 pixels wide, blurred by 1.5
pixels, keeps 28 of 34), and the pixels of one 6 pixels or more from black do not reach black in 5 steps
and are not read as an edge of black and white. A soft-edged gray
stroke 2 or 3 pixels wide running straight out of black, blurred by 1 or 1.5 pixels, loses 3 or 4 of
the 16 pixels nearest black. A soft-edged gray stroke about two
pixels wide that touches black traces as black and white, and one about three pixels wide that touches
black can lose most or all of its gray when it is short (12 pixels long or less). A line of gray one
pixel wide between black and white stays gray when at least 13 of its pixels touch: such a line and a
+1 -1
View File
@@ -1590,7 +1590,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Image Trace Flat Logo mode:** a fourth mode beside Black and White, Grayscale and Color, for flat-colour logos. Each pixel is read as a blend of the logo's colours (found automatically or named), the blend is interpolated smoothly and every outline is placed where two colours are equally present, so edges are accurate to a fraction of a pixel. Outlines are then cleaned: corners the blur rounded are put back, near-straight runs and near-circular arcs become exact lines and arcs, the rest is fitted with as few Béziers as the tolerance allows, touching colours overlap by a hair so no gap opens, and an outline that strays from the raw contour is fitted plainly instead. Gradients and photos are refused with advice to use Color. Line art whose only solid area is white paper (strokes a pixel or two wide) takes its colours from the strokes' cores, with the lighter shades along a stroke's anti-aliased edge folded into its ink; a page whose ink (a channel at least 48 below white) covers under 1% of it traces to nothing, as blank paper does. *Measured* (a local experiment, not run in CI): a flat-colour logo's vector original was rendered down to a soft 199 × 100 px transparent PNG, traced, and the result compared with the original at 1600 px wide. The built-in colour presets (6 Colors, 16 Colors, High Fidelity Photo, Low Fidelity Photo) had a mean edge error of 2.5 to 3.4 px and region overlap of 0.88 to 0.91; Flat Logo had 0.78 px and 0.966 (0.48 px and 0.975 from a crisp source), in about 0.1 s. Limits: flat-colour art only; needle-thin sharp tips are shortened by about 1.7 source pixels because the blur erases them; it works at no more than 1024 px on the long side (larger images are averaged down first); only one logo family has been scored against a vector original.
- **Image Trace, Flat Logo named colors only:** with `logoColors` named, `"logoWhite": false` traces those colors only, so white areas take the nearest of them and no white is added; a named white is kept, and enclosed transparent areas stay holes; code-drawn tests in `crates/trace` and `crates/engine`.
- **Image Trace, Flat Logo flat-art check with named colors:** with `logoColors` named, whether the image is flat art is judged by its own colors, as many as are named, with white, or as the Colors setting gives, whichever is more. Named colors 20 levels off a flat badge's colors still trace it, a hatch on a light ground gives the same result with close and far named colors, a gradient's refusal score does not depend on how far the named colors are from it, and areas of colors that were not named are traced in the named colors instead of being refused; code-drawn tests in `crates/trace`.
- **Image Trace, Flat Logo with a color between two others:** an anti-aliased edge pixel between black and white is read as a blend of black and white, not of black and a gray that lies between them, when the flat areas around it and the pixels beside it show that edge, so a black disc beside a gray square on white, with sharp edges or edges blurred by up to about half a pixel, traces with one gray path, the square, instead of the square plus 8 to 24 gray slivers around the disc with the colors found or named exactly (an edge blurred by a pixel or more, or pixel noise of a level or more, can still leave gray slivers); gray strokes two and three pixels wide beside black stay gray (a soft-edged gray stroke about two pixels wide that touches black traces as black and white, and a short one about three pixels wide can lose most or all of its gray), and a one-pixel gray line of at least 13 touching pixels between black and white stays gray (a shorter one, or one that falls between pixels or is blurred, traces as black and white); code-drawn tests in `crates/trace`.
- **Image Trace, Flat Logo with a color between two others:** an anti-aliased edge pixel between black and white is read as a blend of black and white, not of black and a gray that lies between them, when the flat areas around it and the pixels beside it show that edge, so a black disc beside a gray square on white, with sharp edges or edges blurred by up to about half a pixel, traces with one gray path, the square, instead of the square plus 8 to 24 gray slivers around the disc with the colors found or named exactly; on edges blurred by 1 to 3 pixels, the pixel also counts as on that edge when paths of up to 5 steps through pixels that keep getting darker and lighter reach past the gray both ways, and black and white then lie as near as the steps to them, so the same disc and square trace with one gray path at blurs of 1 to 2 pixels, where up to 33 gray paths were traced before (at a blur of 3 pixels with the colors named, a gray of 200 leaves 4 slivers with no area and a light gray of 230 leaves 8 small slivers, against 11 and 14 gray paths before; pixel noise of a level or more can still leave gray slivers); with sharp edges, gray strokes two and three pixels wide beside black stay gray (a soft-edged gray stroke about two pixels wide that touches black traces as black and white, and a short one about three pixels wide can lose most or all of its gray); on edges blurred by a pixel or more, a soft-edged gray band up to 4 pixels wide along black traces as black and white at blurs of 1.5 and 2 pixels, a soft-edged gray stroke 2 pixels from black can lose some or all of its gray and one 4 pixels away a few pixels, and a soft-edged gray stroke running out of black loses 3 or 4 pixels where it meets black; a one-pixel gray line of at least 13 touching pixels between black and white stays gray (a shorter one, or one that falls between pixels or is blurred, traces as black and white); code-drawn tests in `crates/trace`.
- **Image Trace, Flat Logo with a color beyond both colors of an edge:** an edge pixel between a gray panel and a charcoal disc on a paler gray ground is read as a blend of the panel and the disc, not of the ground and the disc, when the pixels beside it lie on each side of it, none lies past the panel toward the ground, and lighter pixels lead from it to the panel's color or to a flat area of the panel, so the disc traces with three paths, one per color, with the colors found or named, instead of with 28 slivers of the ground around it when its edges are sharp and one sliver when they are blurred by 0.7 pixel (an edge blurred by a pixel or more can still leave slivers of the ground); the pixels of a pale line on the disc, one pixel wide, blurred over three pixels or falling between two pixels, and the edge of a gap of the ground's color between the disc and the panel keep the ground in their blends; code-drawn tests in `crates/trace`.
- **Image Trace, Keep Colors:** `"keepColors": ["#rrggbb", …]` traces only the palette colors near a listed color (Abutting: each with the paths the trace of every color gives it; Overlapping: not reaching under the colors left out), in Black and White, Grayscale and Color; code-drawn tests in `crates/trace` and `crates/engine`.
- **Advanced art:** live Blends (steps/distance/smooth colour, editable spine, anchor-targeted Blend tool, faithful interpolation, knockout), Envelope Distort (warp/mesh/top object, Reset, full Envelope Options, mesh handles, Edit Contents; type, images, symbols, gradients, patterns and appearance distorted everywhere), Liquify tools with options and pen pressure, Puppet Warp with rotating pins, Perspective Grid with presets, movable planes and projected type (choosing a perspective tool shows the grid; Hide Grid hides it with the tool still chosen), Gradient Mesh, Shape Builder (stroke-only open paths and lines cut the regions they cross and enclose regions of their own, and regions they bound merge without seams where the lines cross at rounded coordinates (#893); filled open paths count as closed; erase mode while Alt/Option is held: a minus pointer, red highlights of what will go, a click or drag deletes the regions touched, the pieces of open lines and the edges (outline pieces between the points where paths meet, opening their paths there) it passes over, one undo step, `shapeBuilder.merge {erase}` and `shapeBuilder.regions` edges over MCP), Live Paint (every path an edge, open lines included), Image Trace (12 presets, colour layers traced in parallel; a trace past two million anchor points is refused with advice rather than running out of memory, an image over 64 megapixels is traced scaled down to that size (aspect kept, paths at the image's own size) and one over 192 megapixels is refused, and a selection too large to outline shows its bounds (#525); Object › Image Trace › Make and Make and Expand trace at once with the Default preset, #543; with an image selected the Control bar and the Properties panel show Image Trace, whose arrow traces with any preset, Mask (`object.maskImage`: a clipping path on the image's outline, selected so its handles crop), Crop Image (a crop box on the image, starting on its part over the artboard, dragged by its handles or inside it, the outside dimmed, with X/Y/W/H, Apply and Cancel in the Control bar, Enter and Escape, #734; an image that isn't turned or skewed, isn't CMYK and can be read at its recorded size is cut from its own pixels when the crop edges fall on its pixel grid, copied as they are without resampling; any other image is drawn, #5534; `object.cropImage {rect}` for agents, `{trim: true}` cuts an image to its pixels that aren't fully transparent, pixel for pixel) and Embed or Unembed in place of Fill and Stroke; with an Image Trace object selected, its Preset (choosing another traces again), View, the Image Trace panel and Expand, plus Release in Properties; the five View modes (Tracing Result, with Outlines, Outlines, Outlines with Source Image, Source Image) redraw a trace on screen without tracing again, are saved with it and `imageTrace.setView` sets them, while exports and Expand keep the result; the panel's Advanced section is a header that stays open or closed as it was left (part of #641); Color mode's Palette: Limited, Full Tone (as many colours as the tones need, Less … More), Automatic (flat art with its own colours, else Full Tone; a heuristic) and Document Library (the most used colours of the document's swatches or a swatch library, filled with the swatch colours as they are), part of #641; Advanced › Create: Fills and/or Strokes, where lines up to the Stroke width trace as stroked centre lines (distance transform, thinning, a skeleton graph with spurs pruned, curve fitting; one width per line; without Fills, wider areas become stroked outlines), part of #641), pattern swatches with pattern editing mode, live Repeat (radial/grid/mirror). A single selected mirror repeat shows a prominent axis with a center move handle and two rotation handles. Drag the line or center to change spacing, or an end to change angle; Shift snaps rotation to 45°. The original artwork stays in place, the reflected copy previews live, Escape cancels and each drag takes one undo step through `object.repeat.options`. Controls follow zoom/view rotation and hide with edges or the bounding box. Engine and headless canvas regressions passed for gestures, history and visibility; native move, rotation and Escape screenshots were reviewed. [Public mirror-repeat reference](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/set-mirror-repeat-options.html). A single selected grid repeat shows a handle below the grid for rows, one right of it for columns and one past its bottom-right corner for both, and sliders between its first two columns and rows for the horizontal and vertical spacing; the source keeps its size, each drag is one undo step and Escape cancels it ([public grid-repeat reference](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/set-grid-repeat-options.html), #2691). Object › Expand turns radial, grid and mirror repeats into groups of their instances (#1765, #1756).