{"id":20757284,"url":"https://github.com/piebro/svgdatautil","last_synced_at":"2026-04-21T12:02:40.106Z","repository":{"id":200619294,"uuid":"326723630","full_name":"piebro/svgdatautil","owner":"piebro","description":null,"archived":false,"fork":false,"pushed_at":"2021-01-10T12:02:26.000Z","size":270,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T04:43:32.714Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piebro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-01-04T15:18:43.000Z","updated_at":"2021-01-10T12:02:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"44bf54e2-ad79-46a3-8a67-43e444d4beae","html_url":"https://github.com/piebro/svgdatautil","commit_stats":null,"previous_names":["piebro/svgdatautil"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piebro%2Fsvgdatautil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piebro%2Fsvgdatautil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piebro%2Fsvgdatautil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piebro%2Fsvgdatautil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piebro","download_url":"https://codeload.github.com/piebro/svgdatautil/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243066944,"owners_count":20230828,"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-17T09:41:19.190Z","updated_at":"2026-04-21T12:02:40.065Z","avatar_url":"https://github.com/piebro.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Library for usage of SVGs in machine learning\n\nLibrary to simplify SVGs for machine learning. The simpler SVGs are constist of polylines with discrete points.\n\n## Installation\n\n```bash\npip install -q git+https://github.com/piebro/svgdatautil\n```\n\n## Usage\n\n\n### Simpify SVG\n\n```python\nfrom svgdatautil import svg_to_lines, simplify_lines, save_svg, get_svg_from_lines\n\n# the points of the lines should be in [0 0 1000 1000]\nlines = svg_to_lines(\"examples/1BKZ.svg\")\nsim_lines = simplify_lines(lines, max_xy=1000, rdp_epsilon=1) # rdp_epsilon describes how much the lines are simplified\nsave_svg(\"examples/1BKZ_1000_1.svg\", get_svg_from_lines(sim_lines, background=None))\n```\n\n### Create simplified SVG dataset\n\n```python\nfrom svgdatautil import svg_dir_to_dataset_pkl, save_simplified_dataset_pkl, dataset_pkl_to_lines\n\nsvg_dir_to_dataset_pkl(\"examples\", \"examples.pkl\")\nsave_simplified_dataset_pkl(\"examples.pkl\", \"examples.pkl_2_500_1.pkl\", svg_count_in_new_dataset=2, max_xy=500, rdp_epsilon=1)\nsvg_lines = dataset_pkl_to_lines(\"examples.pkl_2_500_1.pkl\")\n```\n\n## Example\n\nOriginal SVG with 224K:\n\n\u003cimg src=\"examples/1BKZ.svg\" width=\"800\"\u003e\n\n`max_xy=10000` and `rdp_epsilon=0.5` with 40KB:\n\n\u003cimg src=\"examples/1BKZ_10000_05.svg\" width=\"800\"\u003e\n\n`max_xy=1000` and `rdp_epsilon=1` with 28KB:\n\n\u003cimg src=\"examples/1BKZ_1000_1.svg\" width=\"800\"\u003e\n\n`max_xy=250` and `rdp_epsilon=2` with 20KB:\n\n\u003cimg src=\"examples/1BKZ_250_2.svg\" width=\"800\"\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiebro%2Fsvgdatautil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiebro%2Fsvgdatautil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiebro%2Fsvgdatautil/lists"}