Skip to main content

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, 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! :)

Project details


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)

Uploaded Source

Built Distribution

AffinitySvgPatcher-1.0.0-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

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

Hashes for affinitysvgpatcher-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b029317621e1df89c9d609640aca2244546851e191cf619f28575d62de6cccba
MD5 6498422e37db8e53e5ea8d75a3e8621a
BLAKE2b-256 e8e20dd66d22dc2df073320f06451b8062be91420c0863490f5465f853bfb57f

See more details on using hashes here.

File details

Details for the file AffinitySvgPatcher-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for AffinitySvgPatcher-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab1de9fcf753b261e650a66f2231b197f74f6036c3b03f5b0a2a3b2f166522de
MD5 19add3772ac91eec8342b94e479719e0
BLAKE2b-256 1c2f23ccc64b0536f42bea4884bf18e3fd99d72e22a3c38d1e4c624a90532fa7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page