GDSII to SVG
Converting GDSII to SVG means flattening a hierarchical, integer-coordinate mask layout into a self-contained vector image: each GDS polygon becomes an SVG path, each GDS layer becomes a styled group, and the database-unit coordinate space becomes an SVG viewBox. Glyph does this conversion entirely client-side, in your browser.
Why convert GDSII to SVG?
GDSII is a compact binary format built for mask tooling, not for papers, slides, or web pages — most PDF viewers, browsers, and vector editors can't open a .gds file directly. SVG solves that: it's a text-based, resolution-independent vector format that Illustrator, Inkscape, LaTeX (via pdflatex/Inkscape export), and every modern browser already understand. Converting a mask layout to SVG is the usual first step toward a publication figure, a web-embeddable die diagram, or a layout you want to hand-annotate outside a GDS tool.
How GDSII-to-SVG conversion works
A GDSII file stores cells as a hierarchy: a top cell places instances (SREF/AREF) of other cells, and each cell holds boundaries (filled polygons), paths, and text, all as integer coordinates in a fixed database unit. Converting to SVG involves three steps:
- Flatten the hierarchy. SVG has no native "place an instance of this group at this transform" primitive that mirrors GDS references cleanly for a portable snapshot, so a converter walks the reference tree and expands every SREF/AREF into its transformed shape content — translation, rotation, magnification, and mirroring all get baked into each instance's coordinates.
- Map polygons to paths. Each GDS boundary's vertex list becomes an SVG
<path>withM/L(and a closingZ) commands; GDS paths (wires) become stroked<path>elements with a computed width. - Map layers to groups and colors, and units to a viewBox. Each GDS
(layer, datatype)pair carries a display color and fill/stroke style, applied per group so the exported SVG visually matches the editor's layer palette. Because GDS coordinates are integers in a database unit (commonly 1 nm), the whole design's bounding box becomes the SVGviewBoxdirectly — no unit conversion beyond scaling that box into a sane on-screen pixel size, and no floating-point drift.
Because GDS y-axis is up and SVG's is down, a correct converter also flips the Y axis (typically with a single matrix(1 0 0 -1 0 h) transform on the root group) so the exported image reads right-side up.
Convert GDS to SVG in Glyph
- Open your
.gdsfile in Glyph — drag it onto the window or use File → Open. - Choose File → Save as…. Glyph opens one native save dialog that offers
.gds,.svg, and.png— pick a filename ending in.svg. - Glyph flattens the document's active cell (expanding SREF/AREF instances), maps each layer to its own colored group, and writes a self-contained SVG sized to the design's bounding box. Your file never leaves your browser — the conversion runs entirely client-side.
For a publication-ready figure instead of a raw export, use Export figure…, which adds a white background, solid (non-transparent) fills, a scale bar, and a layer legend on top of the same conversion — then save as .svg or .png from the same picker. PNG export renders the generated SVG off-screen at a chosen pixel width, so resolution doesn't depend on your window size or zoom level.
SVG vs PNG for layouts
SVG is a vector format: it stores the polygon geometry itself, so it stays sharp at any zoom level, edits cleanly in a vector editor, and scales to a poster or a thumbnail from the same file. PNG is a raster format: it stores a fixed grid of pixels, so it's simpler to drop into a slide deck or a webpage that expects a plain image, but re-scaling it larger introduces blur or blocking. For a mask layout specifically — sharp polygon edges, often reproduced at several sizes — SVG is usually the better source format, with PNG generated from it (as Glyph does) only when a specific tool or platform requires a raster image.
Further reading
- W3C, Scalable Vector Graphics (SVG) 1.1 — w3.org/TR/SVG11/. The SVG specification.
- MDN, SVG documentation — developer.mozilla.org/en-US/docs/Web/SVG. Reference and tutorials for the
<path>,<g>, andviewBoxprimitives this conversion produces. - Wikipedia, "GDSII" — en.wikipedia.org/wiki/GDSII. Background on the source format.
- For the GDSII record structure this conversion reads from, see the GDSII file format reference.