{
  "id": 18861434,
  "title": "How to offset an SVG outline by a fixed distance with Python and Shapely",
  "url": "https://urgent.news/2026/11/08/how-to-offset-an-svg-outline-by-a-fixed-distance-with-python-and",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-08T04:55:20.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/bestaitool/how-to-offset-an-svg-outline-by-a-fixed-distance-with-python-and-shapely-3cc7"
  },
  "original_language": "en",
  "account": "To offset an SVG outline by a fixed distance using Python and Shapely, begin by converting the SVG artwork into polygons. This process involves sampling the paths, ellipses, and stroked curves into polylines, and buffering their centre lines to create filled shapes. The artboard dimensions serve as the conversion scale, with each unit representing 1 mm.\n\nOnce the SVG has been transformed into shapes, apply the offset to each shape using the buffer method. A positive distance value will expand the polygon, while adjusting the quad_segs parameter determines the number of line segments used for rounding corners. In this example, a distance of three units and 16 quad_segs were used for all shapes.\n\nAfter offsetting each shape, unite them using the unary_union function to form a single outer edge for the sticker. This results in a single closed shape with no holes, measuring 164.8 mm in perimeter. The total length of the nine original outlines is 410.4 mm; thus, the remaining 245.6 mm represent internal edges that do not require cutting.\n\nThe union of all offset shapes maintains the overall size of the sticker with only minor differences compared to the editor's measurements. When offsetting the united artwork, the result is identical to uniting the individual offsets. This confirms that the process is effective and produces accurate results, with minimal deviation due to flattening noise.",
  "summary": "A sticker's white border and its cut line are the same geometry problem: take a drawing, push its outline out by a fixed distance, and keep one closed outer edge. The Vector Editor in the osFoundry desktop app does it with Offset Path followed by Unite. Below is the same pipeline in about 30 lines of Python with Shapely, run on the cat-head SVG used in the app (nine shapes on a 60 mm artboard),…",
  "key_points": [
    "Convert SVG paths into polygons using Shapely",
    "Offset polygons with buffer method, adjusting quadsegs",
    "Union offset shapes to form single closed sticker"
  ],
  "editors_take": "Converting SVG paths into buffered polygons allows for the automated creation of single-edge sticker outlines by eliminating internal edges that do not require cutting during the manufacturing process.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}