Repository navigation
inlaytrace 0.2.0
Minor Changes
-
stacked: truenow works for flat art too: shapes come back to front, each whole, with the parts hidden behind other shapes completed (a disc behind a bar traces as a whole disc). Which shape is in front is read from the junctions where two shapes' shared edge ends. Photos (photo: true) stack as before. -
Flat outline illustrations (thin coloured outlines on white, pale tinted fills) now trace. Speck clean-up folds a speck into its nearest colour, and no longer dissolves a thin stroke that lossy compression split into two shades of its ink.
peakPalettetakes a newwidthoption: given it, pale tints are found by their flatness (new optionsminTint,minFlat), and a colour that is only ever an anti-aliased edge is left out. Slivers under 2 px wide fold into a neighbour of nearly the same colour. New optionphotokeeps the old clean-up for photos (specks join the colour they share the most edge with, no sliver pass), which is what a stackedquantizePalettetrace wants. Binary and centerline modes takethreshold: 'auto'(Otsu, falling back to 128 on a page with nothing to split). A thin closed shape (a 3 px letter stem) no longer collapses to a line, and the fitter no longer grows spikes on thin letters. On a new outline fixture, Logo went from 13.0% to 2.1% of pixels wrong; the badge, emblems and photos (withphoto) score the same. -
New
strokesoption for flat outline art: in palette mode, the colours drawn mostly as thin, long lines are traced down their middle as one stroked path each (InlayPath.strokeis the width measured from the ink), with their anti-aliased edges and darker shades joined in, and the shapes either side meet beneath them. Small lettering, short marks and solid shapes stay shapes.scalesays how far the image was enlarged, so the line widths scale with it. Off by default; output without it is unchanged.toSvgandcenterlineToSvgnow escape the attribute values they write, so a palette colour given with a quote in it can't end its attribute. -
peakPalettefinds colours spread over several histogram bins (a photo's red lettering, a small decal) instead of stopping at the greys; flat art's palettes are unchanged. New optionminDetail. Stacked shapes now reach under the neighbours painted after them, so no hairline seam shows where two shapes meet (12% closer on photos, about a third more path data). -
Lines within a degree of horizontal, vertical or 45° are now exactly that, so a square stays square after JPEG and lines either side of a junction line up.
fitChaintakessnap: falseto keep lines as fitted.
Patch Changes
centerline(rgba, width, height, options)(andtraceCenterline,centerlineToSvg): single strokes down the middle of the ink, for pen plotters and engraving, with the stroke width measured from the ink or set.- Add a funding link (Ko-fi) to the package metadata.
- New
gradientsoption: soft shading that a palette splits into bands of tints is traced as one shape with a linear or radial gradient (path.gradient, written bytoSvgas<linearGradient>/<radialGradient>), when the gradient fits much better than a flat colour. Off by default. - Lines about a pixel wide stay in one piece at a slant, instead of breaking into dashes or vanishing.
- Centerline and outline-art strokes run straight through junctions. Thinning bends the skeleton toward each junction, so an X of thick strokes came out pinched at its crossing and a T's stem bent to meet the bar; within a stroke width of a junction the arms are now cut back and drawn straight on to where their own lines meet.
- Small text and dots beside flat art now trace. Thin anti-aliased strokes (1.5 px grey letters) were labelled as the paper, pale edges as a nearby colour, and each letter then cleared as a speck. In flat art (not
photo), a pixel between colours and close to none of them is now read as a mix of the pair that explains it best; one next to only one other colour keeps its own; and a speck that stands well apart from every colour around it stays from an eighth of the speck area up, so raisingspecklestill clears it. Poster output is unchanged. - In images with exactly flat colours, such as most PNG exports, edges are placed between pixels from their anti-aliasing instead of on the pixel grid: straight sides land where they really are, and small shapes come out cleaner (2–16% fewer wrong pixels on the PNG fixtures, for the same nodes). Whether an image qualifies is judged from its pixels, so typical JPEG and WebP traces and Poster are unchanged.
toSvgescapes the drawing's width and height like every other value it writes.- Lines one or two pixels wide keep their width to their ends. Where such a line's outline turned back at its end inside one fitted run (an arm of a T or a Y), its two sides were joined at a point, so each arm tapered to nothing and thin outlines looked broken.