SVG Files
SVG (Scalable Vector Graphics) is the vector format of the web, and Inkscape's own format. Most drawing programs read and write it, including Illustrator, Affinity Designer, CorelDRAW and Figma. Import one with File › Import › Import… (or place one with the Vector Import Tool), and save one with File › Export › Export…, choosing SVG Files. Compressed SVG (.svgz) is read too.
Import
Shapes: paths (straight lines, curves and elliptical arcs), rectangles (rounded too), circles, ellipses, lines, polylines and polygons. Curves that are really circular arcs or straight lines come in as arcs and lines.
Placement: groups, transforms (moved, rotated, scaled, skewed), nested drawings, symbols and their uses are all followed, so everything lands where the file shows it.
Size: the drawing comes in at the size the file gives it (
width="210mm", say). A file with no size is taken to be in pixels, 96 to the inch.Colours and lines: colours, stroke widths and dashes are read from the file's attributes, its
styleattributes and its style sheet.Fills: a filled shape comes in as its outline (hidden, if it isn't stroked) and a fill in its colour, with its opacity, or its gradient: linear and radial gradients come in as they are, with their stops, focus, spread (pad, reflect, repeat) and transform. A pattern, or a gradient on a line, comes in in a single colour of its own; a partly transparent line as it looks on white paper.
Layers: Inkscape's layers, and the top-level groups that Illustrator and other programs write for their layers, become layers named after them. Each line then goes on a layer by its layer's name or its colour, exactly as for PDF: a layer called Cut or Die line goes on Cut, Crease on Crease, and so on. A file whose whole picture is in one top-level group (as matplotlib and many other programs write them) has no layers, unless that group is named for a die-making layer: its lines go on layers by their colours.
Text: each piece of text comes in as text, at its place, size and angle, in its font.
Images: pictures embedded in the file come in as raster images. A picture the file links to is looked for beside the file.
Clipping: a
clip-pathon a shape or a group is applied as it is for PDF: lines are cut where they cross the clip, fills to the area they share with it, and text and images are kept whole if they reach into it. The clip path's own transform, its clip rule, andobjectBoundingBoxunits are followed.
Masks and filters are not applied: what they would hide comes in too. The messages after the import say when a file uses them, or refers to a clip path it doesn't have. Anything hidden in the file (not displayed, or fully transparent) is left out.
The import options (Dielines only, Text, Raster images, Line widths, A layer for each artwork colour …) are those for PDF.
Export
- Each layer is a layer (an Inkscape layer, which Illustrator also opens as a layer) named after it.
- Lines are in their layers' colours, with their line widths (0.5 pt for lines without one) and dashes.
- Fills are painted: colours with their opacity, linear and radial gradients as SVG gradients. SVG has no conic or four-corner gradients: they are drawn within the fill's outline (thin wedges, or two blended gradients), and ParametrIQ CAD reads them back as the gradients they were.
- Text is written as text, in its font, or as outlines with Text as outlines in the export options.
- Raster images are embedded in the file.
- Magnifiers: what a magnifier's callout shows is a group cut to the callout by a
clipPath, in each layer that has some of it. - The size is the drawing's, in millimetres, with a margin round it (18 pt unless you give another), or a page's (A4 landscape, say) with the drawing scaled to fit it: see File Formats.
In the playground
The playground shows what your code draws as a PNG picture or as SVG (switch between them above the picture), in colours that suit the page's light or dark theme. Use the download button to save the picture as it is shown.