A module for patching matplotlib-generated SVG files to make them work Affinity Designer.
Project description
AffinitySvgPatcher
Patches Matplotlib-generated svg to be able to open them properly in Affinity Designer.
It can be yours simply though
pip install AffinitySvgPatcher
Usage
From python
from AffinitySvgPatcher import AffinitySvgPatcher
patcher = AffinitySvgPatcher('path/to/file.svg')
patcher.patch_svg(save = True, save_dir = 'dir/to/save', postfix = '-patched')
From command line
AffinitySvgPatcher path/to/file.svg --postfix patched --dir .
Patches
For now I have discovered the following tricks:
- in
text
elements, replacefont
attributes withfont-size
andfont-family
(font
is apparently ignored by AD), - in
xlink:href
(which are deprecated) replacex
andy
attributes withtransform=translate(x y)
(AD seems to ignorex
ory
attributes).
If more issues become known, PRs or GH issues are welcome! :)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
affinitysvgpatcher-1.0.0.tar.gz
(40.8 kB
view details)
Built Distribution
File details
Details for the file affinitysvgpatcher-1.0.0.tar.gz
.
File metadata
- Download URL: affinitysvgpatcher-1.0.0.tar.gz
- Upload date:
- Size: 40.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b029317621e1df89c9d609640aca2244546851e191cf619f28575d62de6cccba |
|
MD5 | 6498422e37db8e53e5ea8d75a3e8621a |
|
BLAKE2b-256 | e8e20dd66d22dc2df073320f06451b8062be91420c0863490f5465f853bfb57f |
File details
Details for the file AffinitySvgPatcher-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: AffinitySvgPatcher-1.0.0-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab1de9fcf753b261e650a66f2231b197f74f6036c3b03f5b0a2a3b2f166522de |
|
MD5 | 19add3772ac91eec8342b94e479719e0 |
|
BLAKE2b-256 | 1c2f23ccc64b0536f42bea4884bf18e3fd99d72e22a3c38d1e4c624a90532fa7 |