Practical guide
Vectorize an icon set with transparent backgrounds
Crop the source sheet, remove only border-connected backgrounds, then choose a recipe for outline or shaded artwork.
Problem
Icon sheets often mix a near-white cell background with anti-aliased edges, narrow gaps, and attached neutral shadows. A broad color-key can erase white artwork inside the icon. Kurviq instead removes border-connected pixels and protects areas that are only reachable through narrow channels.
Command
npx kurviq --input icon.png --output icon.svg \
--remove-background auto --background-fuzz 3 \
--background-channel 3 --mode spline \
--filter_speckle 4 --path_precision 1 --segment_length 8Before and after
Accessibility — outline icon
Thin strokes and enclosed shapes after background removal.
The SVG keeps the enclosed outline while the removed background becomes transparent. Always inspect the result on a dark surface; white halos and accidentally removed light details are much easier to see there.
Workflow
1. Crop first
Export one icon per raster file with a small border around the artwork. Auto background selection reads the border, so a clean crop gives it an unambiguous sample.
2. Apply the shared spline recipe
Spline mode fits smooth contours. A speckle filter of 4 removes tiny islands, path precision 1 retains useful coordinate detail, and segment length 8 avoids over-segmenting rounded shapes.
3. Branch by style
For blurry flat or outline icons, add --upscale 2 --sharpen. For soft-shaded 3D icons, add --upscale 2 --gradient_step 8 --color_precision 8 instead. Sharpening flattens ramps, so do not combine it with the gradient recipe.
Flag reference
| Flag | Value | Why it is here |
|---|---|---|
--remove-background | auto | Samples the border and removes only connected background pixels. |
--background-fuzz | 3 | Uses a conservative color tolerance for near-uniform cells. |
--background-channel | 3 | Protects regions that can only be reached through narrow gaps. |
--mode | spline | Fits smooth curves instead of polygon facets. |
--filter_speckle | 4 | Drops isolated four-pixel noise. |
--path_precision | 1 | Keeps coordinates precise enough for small icons. |
--segment_length | 8 | Produces longer, smoother contour segments. |