Urgent.News

What's breaking now, across thousands of outlets.

Tech

How to offset an SVG outline by a fixed distance with Python and Shapely

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),…

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.

Once 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.

After 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.

The 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.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Modeling A2A with the x-a2a Extension

Quick answer: The x-a2a extension models an A2A operation inside an OpenAPI document, holding the version, binding, endpoint, method, Agent Card URL, explicit request and response contracts, and…

  • x-a2a extension models A2A operations in OpenAPI documents
  • Holds metadata like version, binding, endpoint, and examples
  • Uses x- prefix to distinguish vendor-specific metadata

Hetzner Price Increase 2026: Cheaper VPS Alternatives

Originally published at LeanStack . For years Hetzner was the default answer to "where do I get a cheap VPS?" In 2026 that changed.

  • Hetzner raised VPS prices in 2026 due to AI data-center demand.
  • Other European hosts like OVHcloud and netcup also increased prices.
  • U.S. users may find DigitalOcean cheaper than Hetzner's U.S. locations.

Ebook Voice Player Privacy-First Architecture: Local Parsing, Minimal Cloud, Full Data Flow Transparency

Product Link : Microsoft Store - Ebook Voice Player Introduction In an era of increasing data privacy concerns, Ebook Voice Player establishes privacy-first design principles at the architectural…

  • Ebook Voice Player processes documents locally without network requests.
  • Text-to-speech sends only text content to cloud with voice identifier.
  • Privacy maintained through no accounts, telemetry, or ad tracking features.

Proven, Proven-Empty, and Gap Completeness Gates

Quick answer: The completeness gate classifies every parameter, body, and response in a scanned route as proven, proven-empty, or gap, so nothing is left silently blank.

  • Completeness gate classifies route elements as proven, proven-empty, or gap
  • Proven means code confirmed presence and shape of value
  • Proven-empty indicates code confirmed absence of value

How PDF Compression Works Under the Hood

A PDF is not one solid block of data. It is a small filing cabinet: a set of objects — pages, text, fonts, images — held together by a table of contents.

  • PDF compression targets individual objects like pages, text, fonts, and images
  • Specialized algorithms squeeze content for optimal compression
  • Resulting file is smaller with extraneous data, redundant info, and metadata removed

More from Sunday 8 November →