Free Christmas SVG is a library of free cut files for Cricut and Silhouette machines: snowflakes, trees, Santa hats, sayings. Every design has a small editor on its page. You can recolour it, resize it, rotate or mirror it, add an offset border, and then download it as SVG, DXF, PDF, EPS, PNG, JPG or WebP.
There's no server involved, and no export library either. The site's runtime dependencies are Astro, Tailwind, a sitemap plugin and fonts. Every file writer is hand-written, in one 267-line file. The editor script is 13 KB gzipped.
That's only possible because of a decision made long before the editor existed: every design is made of straight lines.
Key takeaways
- Constrain your source data, and the format writers become simple.
- DXF R12 and a minimal PDF are small enough to write by hand.
- Canvas exports need real DPI metadata, or cutting software gets the size wrong.
- "Cut-ready" is measurable: smallest piece, smallest hole, thinnest feature, all checked by script.
The constraint: M, L, H, V and Z only
Every published path uses only five SVG path commands: move, line, horizontal line, vertical line and close. No curves, no arcs. This was checked across all 1,083 files when the editor was built, and they parse and render back pixel-identically.
Curves still exist in the designs. They're just flattened into short straight segments when a design is generated. At cutting scale, nobody can tell.
That one rule simplifies everything downstream:
- A path parses into rings of points, an array of
[x, y]arrays. - Rotate, mirror and flip are applied to the points themselves, so no export ever contains a
transformattribute. - Thickening a design or adding an offset border uses Clipper on those rings, with round joins. It changes the real cut lines instead of adding a stroke that a cutting machine wouldn't cut. Clipper is 25 KB gzipped, so it only loads the first time you use one of those features.
- Writing it back out is simple: an absolute move, then relative lines, at 0.1-unit precision.
The formats
SVG
One <g fill> per colour layer, each tagged with a data-layer attribute. Cricut Design Space and Silhouette both treat groups as separate layers you can cut in different colours.
PNG, JPG and WebP: the DPI problem
These go through the canvas: draw the SVG into an Image, draw that onto a canvas, then canvas.toBlob(mime, 0.92). Output is capped at 6,000 pixels.
The catch is size. Cutting software reads the image's DPI to decide how big it is, and browsers write 72 DPI or nothing. A "4-inch" design at 300 DPI shows up much too large. So the editor patches the DPI itself:
-
PNG: it writes its own
pHYschunk, with its own CRC-32, and replaces any chunk the browser wrote. - JPG: it patches the density bytes in the JFIF header directly:
b[13] = 1; // units: dots per inch
b[14] = dpi >> 8; b[15] = dpi & 0xff; // X density
b[16] = dpi >> 8; b[17] = dpi & 0xff; // Y density
Some browsers can't encode WebP and quietly hand back a PNG instead. The editor checks the type it got. If it isn't what you asked for, you see "This browser cannot save WEBP. Try PNG." rather than a file with the wrong extension.
A hand-written PDF 1.4: five objects and an xref table. SVG's y-axis points down and PDF's points up, so the content stream starts with a flip matrix (k 0 0 -k 0 h cm). Then it's just m, l, h and f operators, since everything is straight lines. If the browser supports CompressionStream('deflate'), the stream is compressed and marked /FlateDecode.
EPS
EPSF-3.0 with a %%BoundingBox and %%HiResBoundingBox, and short aliases like /m {moveto} bind def. It uses the same path-to-operators function as the PDF.
DXF: the one that matters most
DXF R12 ($ACADVER AC1009) is the oldest and most widely supported version. Each ring becomes a closed POLYLINE made of VERTEX entities, with one layer per colour. Units are set with $INSUNITS: inches, millimetres or centimetres. Each colour maps to the nearest AutoCAD colour index, with black and white both sent to 7, so laser software can still tell the layers apart.
Why bother with DXF? Silhouette Studio's free Basic Edition can't open SVG files, but it does open DXF. Before the DXF export, the FAQ had to tell Basic users to trace a PNG. Now they get the real cut lines.
What "cut-ready" means, in numbers
A design that looks fine on screen can be miserable to cut and weed: a dot so small the blade tears it, a gap you can't pick out with a hook. So every design is checked by a script before it can be published. Coordinates are on a 1000×1000 grid. At a 4-inch cut, 1 unit is about 0.1 mm.
export const LIMITS = {
minPieceArea: 400, // smallest separate piece (~2 mm square at 4 in)
minHoleArea: 250, // smallest cut-out to weed (~1.6 mm square at 4 in)
minSpeckArea: 40,
thinRadius: 4, // features thinner than 8 units are flagged
thinLossMax: 0.006, // allowed area loss from the opening test (0.6%)
maxNodes: 6000, maxPieces: 80, maxBytes: 200_000, minBytes: 200,
};
It also rejects open paths, and any file that contains text, images, masks, filters, clip paths, strokes or transforms. The thinnest feature is found with a binary search on morphological opening. Each design gets a "minimum cut size", the smallest finished width where every feature stays at least 1 mm wide. The floor is 1.5 inches and the median is 3.5.
Of the 707 Christmas designs, 655 pass and are marked cut-ready. The other 52 are still published but marked as not cut-ready, all for thin features.
Bugs the checks didn't catch at first
Overlapping shapes cancelling out. Plate snowflakes had holes where arms crossed. Polygons were wound in different directions, so overlaps cancelled instead of merging. The fix normalises the direction of every ring before combining them.
Letters losing their centres. The cleanup step fills holes smaller than 250 units, because that's too small to weed at 4 inches. But it also filled the inside of letters like "a" and "e" at every size, and it ran before the checks, so no check failed. 19 of the 35 coded sayings had filled-in letters on the live site. Now letter centres are only filled if they're true specks (under 40 units). A small letter centre raises the design's minimum cut size instead, by 4 in × √(250 / area). A test now asserts that "an A is not a solid triangle".
Cached old designs. After redrawing designs, returning visitors still saw the old images for up to 30 days. Image URLs now include a hash of each file, so a changed file gets a new URL.
Was hand-writing it worth it?
For this site, yes. The formats are small when the input is constrained, the editor loads fast, and there's nothing to keep updated. The main cost is testing: each format was checked by opening it in a parser and comparing renders pixel by pixel at 256 px, and the DPI is read back from each image.
If your source data has curves, text and transforms, use a library. If you can control the data, constrain it first. The writers get much simpler.
You can try the editor on any design, for example the snowflake SVG or Christmas tree SVG collections. Free for personal use, and small makers can sell up to 500 finished items per design; the licence has the details.

Top comments (0)