Skip to main content

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, replace font attributes with font-size and font-family (font is apparently ignored by AD),
  • in xlink:href (which are deprecated) replace x and y attributes with transform=translate(x y) (AD seems to ignore x or y attributes).

If more issues become known, PRs or GH issues are welcome! :)

Metadata

Release files for AffinitySvgPatcher 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for AffinitySvgPatcher 1.0.0
File Size Uploaded
affinitysvgpatcher-1.0.0.tar.gz 40.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for AffinitySvgPatcher 1.0.0
File Interpreter ABI Platform
AffinitySvgPatcher-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 70.2 kB

Release files / affinitysvgpatcher-1.0.0.tar.gz

Download URL affinitysvgpatcher-1.0.0.tar.gz
Size 40.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b029317621e1df89c9d609640aca2244546851e191cf619f28575d62de6cccba
BLAKE2b-256 checksum
How to use checksums
e8e20dd66d22dc2df073320f06451b8062be91420c0863490f5465f853bfb57f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / AffinitySvgPatcher-1.0.0-py3-none-any.whl

Download URL AffinitySvgPatcher-1.0.0-py3-none-any.whl
Size 29.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab1de9fcf753b261e650a66f2231b197f74f6036c3b03f5b0a2a3b2f166522de
BLAKE2b-256 checksum
How to use checksums
1c2f23ccc64b0536f42bea4884bf18e3fd99d72e22a3c38d1e4c624a90532fa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page