{"id":18380172,"url":"https://github.com/mossblaser/svgoutline","last_synced_at":"2025-04-06T22:32:51.491Z","repository":{"id":57472569,"uuid":"165695266","full_name":"mossblaser/svgoutline","owner":"mossblaser","description":"A Python library which extracts strokes (outlines) from an SVG file as a series of line segments appropriate for driving pen plotters","archived":false,"fork":false,"pushed_at":"2024-06-04T06:31:18.000Z","size":96,"stargazers_count":20,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T08:11:08.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mossblaser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-14T16:33:25.000Z","updated_at":"2025-03-19T13:55:32.000Z","dependencies_parsed_at":"2024-11-06T00:42:08.126Z","dependency_job_id":null,"html_url":"https://github.com/mossblaser/svgoutline","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"f84f0261a75f52dc85afde9851ab55012e2d1fee"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mossblaser%2Fsvgoutline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mossblaser%2Fsvgoutline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mossblaser%2Fsvgoutline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mossblaser%2Fsvgoutline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mossblaser","download_url":"https://codeload.github.com/mossblaser/svgoutline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247563906,"owners_count":20958971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T00:42:04.431Z","updated_at":"2025-04-06T22:32:51.232Z","avatar_url":"https://github.com/mossblaser.png","language":"Python","funding_links":[],"categories":["Software"],"sub_categories":["Vector Utilities"],"readme":"svgoutline\n==========\n\nThis Python library extracts all strokes (outlines) from an SVG vector graphics\nfile as a series of straight line segments appropriate for driving pen plotters\nor desktop cutting machines.\n\n\nFeatures\n--------\n\n* **Supports most common SVG features** including beziers, shapes, simple text,\n  dashed lines and object/layer visibility. Converts all of these\n  into simple straight line segments with no transformations required:\n  \n  ![Input SVG](./samples/basic_sample_input_text_as_outlines_for_readme.svg)\n  ![Arrow](./samples/arrow.svg)\n  ![Output SVG](./samples/basic_sample_output.svg)\n* **Ignores out non-stroked objects.**\n  \n  ![Input SVG](./samples/outline_only_sample_input.svg)\n  ![Arrow](./samples/arrow.svg)\n  ![Output SVG](./samples/outline_only_sample_output.svg)\n* **Curves are approximated by straight lines** with user-defined fidelity.\n  \n  ![Input SVG](./samples/curve_resolution_sample_input.svg)\n  ![Arrow](./samples/arrow.svg)\n  ![Output SVG](./samples/curve_resolution_sample_output_0.2.svg)\n  ![Output SVG](./samples/curve_resolution_sample_output_1.0.svg)\n  ![Output SVG](./samples/curve_resolution_sample_output_5.0.svg)\n* **Captures stroke colours** in RGBA format and millimetres respectively (e.g.\n  to allow colour/thickness dependent cutting/plotting settings).\n  \n  ![Input SVG](./samples/colours_sample_input.svg)\n  ![Arrow](./samples/arrow.svg)\n  ![Output SVG](./samples/colours_sample_output.svg)\n\n\nUsage\n-----\n\nInstall from PyPI:\n\n    $ pip install svgoutline\n\nProvide a valid SVG deserialised from XML using Python's [`ElementTree`\nAPI](https://docs.python.org/3/library/xml.etree.elementtree.html):\n\n    \u003e\u003e\u003e import xml.etree.ElementTree as ET\n    \u003e\u003e\u003e from svgoutline import svg_to_outlines\n    \n    \u003e\u003e\u003e tree = ET.parse(\"example.svg\")\n    \u003e\u003e\u003e root = tree.getroot()\n    \n    \u003e\u003e\u003e outlines = svg_to_outlines(root)\n\nWhere `outlines` will be a `list` of lines of the form:\n\n    [\n        ((r, g, b, a), line_width, [(x, y), ...]),\n        ...\n    ]\n\nWith `r`, `g`, `b` and `a` being between 0.0 and 1.0, and with `line_width` and\nthe coordinates being given in millimetres.\n\nSee `help(svg_to_outlines)` (or\n[`svg_to_outlines.py`](./svgoutline/svg_to_outlines.py)) for full usage\ninformation.\n\nAlternatively, a quick'n'dirty demo script is provided in `samples/demo.py`\nwhich generates the examples above given an SVG file as input. See `python\nsamples/demo.py --help` for more information.\n\n\nLimitations\n-----------\n\n* **Only [SVG Tiny 1.2](https://www.w3.org/TR/SVGTiny12/) is supported** due to the\n  use of [Qt SVG](http://doc.qt.io/qt-5/qtsvg-index.html) internally. The\n  following significant features are missing which you might otherwise expect:\n  * Clipping masks are not supported and will be ignored.\n  * Many text features beyond simple single-line text strings are not\n    supported, for example text on path, line wrapping or style changes mid\n    text element.\n* **Depends on [Qt for Python (a.k.a.\n  PySide6)](https://wiki.qt.io/Qt_for_Python).**  This is a relatively\n  non-trivial dependency but is easy to install from\n  [PyPI](https://pypi.org/project/PySide6/) on most platforms. Unfortunately it\n  makes svgoutline subject to the same bugs (e.g.\n  [QTBUG-72997](https://bugreports.qt.io/browse/QTBUG-72997) which at the time\n  of writing causes text outlines and dash patterns to render too small).\n* **Oblivious to fills and overlaps.** Consequently, if two shapes overlap,\n  their full outlines will be included in the output regardless of what parts\n  of their outlines are actually visible. For plotting purposes this should not\n  be a significant problem as input SVGs are unlikely to contain filled\n  elements.\n* **Output does not distinguish between closed paths and paths whose start and\n  end coordinates are the same.** This distinction is not important for most\n  plotting applications.\n\n\nTests\n-----\n\nThe tests are written using [py.test](https://docs.pytest.org/en/latest/) and\ntest dependencies can be installed and the tests executed with:\n\n    $ pip install -r requirements-test.txt\n    $ py.test tests\n\nThe code adheres to the Python [PEP8 style\nguide](https://www.python.org/dev/peps/pep-0008/) and is checked using\n[flake8](http://flake8.pycqa.org/en/latest/) (installed with py.test in the\ncommands above). Run it using:\n\n    $ flake8 tests svgoutline\n\n\nLicense\n-------\n\nGNU Lesser General Public License v3 (LGPLv3)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmossblaser%2Fsvgoutline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmossblaser%2Fsvgoutline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmossblaser%2Fsvgoutline/lists"}