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 hashes)
Built Distribution
Close
Hashes for AffinitySvgPatcher-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab1de9fcf753b261e650a66f2231b197f74f6036c3b03f5b0a2a3b2f166522de |
|
MD5 | 19add3772ac91eec8342b94e479719e0 |
|
BLAKE2b-256 | 1c2f23ccc64b0536f42bea4884bf18e3fd99d72e22a3c38d1e4c624a90532fa7 |