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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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