---
title: 'SVG and bitmap import'
part: 'Part X — Tooling and Ecosystem'
partNumber: 10
order: 2
subtitle: 'Vector staging, raster thresholding, cropping, tracing, and production cleanup'
---

SVG import is the vector route. Quick import and the staging workspace share one conversion
pipeline, so the preview is compiled from the same NeedleScript that will be inserted. Source
geometry stays named and editable; a shape's fill and stroke become separate construction
operations that reference that geometry once. Compound paths honor both SVG fill rules, and nested
groups, inherited paint, transforms, physical stroke widths, and the active hoop field survive the
handoff.

The options workspace assigns conservative recipes: closed fills start as tatami, narrow or unknown
strokes as running outlines, and only known 2–8 mm strokes start as satin. Unsupported paint or
elements appear as findings instead of being silently approximated. Editable SVG curves are emitted
as `// [curve]` anchor specs and converted to logical geometry with `curveflat`; recipe stitch length
and density remain separate from that geometry tolerance.

Relationships are deliberate construction choices. Select exactly two single-path operations in
the order you mean them, then choose **Create relationship**. Two open paths can become authored
satin rails; the emitted code retains both bindings and calls `satinbetween`. Or use the first path
as a route and repeat the second as a centered motif through `std.layout.alongpath` and a reusable
placement procedure. No proximity matching or baked zigzag coordinates are hidden in either recipe.

Bitmap import adds crop and threshold controls that generate editable path code. Both workflows end
with a real NeedleScript program and a sewability check, rather than a private stitch-object format.

<Run>{`import std.pathops.simplifypath as simplify

// Imported geometry is ordinary path data: refine it before sewing
let outline = trace [ repeat 4 [ fd 20 rt 90 ] ]
let clean = simplify(resample(outline, 1), 0.5)
sewpath(clean)`}</Run>

<Checkpoint chapterId="ch-60">
  Import a small SVG containing two open paths. Select them explicitly, pair them as satin rails,
  and confirm that the inserted program keeps both path declarations and calls `satinbetween` once.
</Checkpoint>
