slopsock
v0.1.0
Published
SlopSock cleans up busted AI logos and kicks out SVG you can actually use
Maintainers
Readme
🧦SlopSock
Deterministic raster to professional SVG cleanup for AI born logos and other pixel graphics.
SlopSock does two things in sequence.
First it uses Inkscape's native trace action to turn a PNG, JPG, WEBP, or GIF into stacked color vector layers.
Then it throws away the wobbly trace paths and rebuilds each layer from geometry, using contour resampling, corner aware smoothing, adaptive simplification, ellipse fitting for badge rings and other clean rounded forms, and cubic Bézier redraw. The result is a fresh SVG that keeps the concept while cutting the tiny vector sins, weird oblong mush, and spaghetti line artifacts that show up in AI generated logos.
Install
npm install -g slopsockPackage name is slopsock, but it is not published to the npm registry yet. Use the curl installer below for now.
For a one line machine bootstrap that installs the host dependencies first on supported systems:
curl -fsSL https://slopsocket.lmtlssss.fun/install.sh | bashSlopSock expects these tools on the machine.
Inkscape 1.3 or newer
Python 3.10 or newer
On Linux, xvfb-run is strongly recommended so Inkscape can trace headlessly.
If the required Python packages are already installed, SlopSock uses the system Python. If not, it bootstraps a private virtual environment on first run and installs the required Python packages automatically.
Quick start
slopsock ./logo.pngThat writes these files next to the input.
logo.clean.svg
logo.preview.png
logo.compare.png
logo.report.json
Typical AI logo pass
slopsock ./bison.jpg \
--profile ai-logo \
--trace-svg ./bison.traced.svg \
--output ./bison.clean.svg \
--preview ./bison.preview.png \
--compare ./bison.compare.png \
--report ./bison.report.jsonProfiles
default is a balanced general purpose mode.
ai-logo pushes harder on mushy rounded blobs, near circular badges, and synthetic curvature wobble.
badge favors circular marks, emblems, and stamp style logos.
silhouette is tuned for bold single shape marks and character silhouettes.
Controls
Trace stage controls map directly to the Inkscape trace action.
--scans 8
--smooth true
--stack true
--remove-background true
--speckles 4
--smooth-corners 1.0
--optimize 0.2Rebuild stage controls tune the redraw engine.
--render-size 2048
--alpha-blur 1.2
--spacing 4.0
--curve-smooth 1.25
--simplify 2.0
--tension 0.88
--noise-floor 1.0
--intersection-bias 0.85
--oblong-bias 0.75
--symmetry-bias 0.4
--ellipse-fit true
--min-area 36
--preview-scale 1600The knobs matter like this.
spacing controls how densely contours are resampled before redraw.
curve-smooth controls how hard the path is smoothed before simplification.
simplify controls point reduction. Higher numbers reduce more anchors.
tension controls Bézier handle reach. Higher numbers feel more fluid.
noise-floor increases cleanup strength on tiny local wobble.
intersection-bias preserves tight junctions and near touches more carefully.
oblong-bias increases regularization for suspicious rounded synthetic blobs.
symmetry-bias increases willingness to snap clean rings and ellipse like shapes into mathematically regular curves.
Examples
A heavy cleanup pass for noisy enterprise logo comps.
slopsock ./mark.jpg \
--profile ai-logo \
--scans 10 \
--speckles 6 \
--curve-smooth 1.5 \
--simplify 2.2 \
--oblong-bias 1.2 \
--symmetry-bias 0.7A more conservative pass that preserves sharp letterforms.
slopsock ./wordmark.png \
--profile default \
--curve-smooth 0.95 \
--simplify 1.4 \
--intersection-bias 1.0 \
--ellipse-fit falseHow it works
SlopSock does not blindly call simplify on a traced SVG and hope the goblin leaves the building.
It traces the raster into stacked fills.
It rasterizes each traced layer to a clean alpha mask at high resolution.
It extracts contours and holes.
It computes shape descriptors such as circularity, eccentricity, corner count, local wobble, and near self approach density.
It chooses adaptive smoothing and simplification constants per contour.
It fits ellipses when the contour is strongly badge like.
It converts the cleaned contours into fresh cubic Bézier paths.
It writes a new layered SVG and a report with similarity metrics against the traced intermediate.
CLI help
slopsock --helpDiagnostics
slopsock --doctorDevelopment
Run tests.
npm testThe smoke test skips the end to end trace pass when Inkscape is unavailable on the host. Use the curl installer above or install Inkscape manually to exercise the full pipeline.
Pack the module like npm would publish it.
npm packKnown boundaries
This is strongest on logos, badges, posters, emblems, mascots, and graphic marks with reasonably flat color regions.
It is not a photorealistic vectorizer.
Tiny distressed texture and photographic grain are intentionally regularized away because those are usually the exact gremlins poisoning production vectors.
