picosvg
Tool to simplify SVGs. Converts an input svg into a "pico" svg:
- Exactly 1
<defs>element, first child of root - Only gradients defined under
<defs> - After the initial
<defs>, only<g>and<path><g>is eliminated when possible, but may be retained for opacity
- Only absolute coordinates
- Only commands that specify full coordinates, no shorthand (H, S, etc)
Clip paths and strokes are rendered into equivalent paths using Skia via skia-pathops, <use> references are materialized, etc.
Some SVG features are not supported, of particular note:
<filter><mask>
Usage:
pip install -e .
picosvg mysvg.svg
Requires Python 3.10 or greater.
Test
Install the dev dependencies specified in extras_require.
pip install -e .[dev]
pytest
If you use zsh, it will prompt an error(zsh: no matches found: .[dev]). Please use the following command:
pip install -e '.[dev]'
You can also use pytest to test the specified files individually.
pytest tests/svg_test.py
If you need to test a certain function (for example: test_topicosvg), please execute:
pytest tests/svg_test.py::test_topicosvg
If you need to display detailed diff information, please execute:
pytest tests/svg_test.py::test_topicosvg --vv
Releasing
Metadata
Release files for picosvg 0.23.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| picosvg-0.23.0.tar.gz | 120.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| picosvg-0.23.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 173.1 kB
Release files / picosvg-0.23.0.tar.gz
| Download URL | picosvg-0.23.0.tar.gz |
|---|---|
| Size | 120.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3616d5eb3ee810e74a931ffa68e2c36cd06a2eef24400a97dc07c0e6cc5eb4c
|
|
BLAKE2b-256 checksum How to use checksums |
3bd22e69443424c880f433cd37c841e2db37ecd41cb5de73844a363b7a146d26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / picosvg-0.23.0-py3-none-any.whl
| Download URL | picosvg-0.23.0-py3-none-any.whl |
|---|---|
| Size | 52.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f18d9b0f69bccd7773bc1de6932f505dc71dc16fb439b4d844716d8f57450b3c
|
|
BLAKE2b-256 checksum How to use checksums |
4896fe3de3f0d5513636cb7bbfd0a693a6bc582ca0c2aeec03250e44a5aa144e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|