Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

pynanosvg

Travis | AppVeyor

Pynanosvg is a wrapper around nanosvg a simple svg parsing library. I created pynanosvg because the only other options in Python were the librsvg bindings, which are very large!

Install

Simple:

git clone --recursive https://github.com/ethanhs/pynanosvg.git
cd pynanosvg
python3 -m pip install -r requirements.txt
python3 setup.py install

or just

python3 -m pip install pynanosvg

Usage

The following parses an SVG file, rasterizes it, and saves it as a PNG

# import things
from svg import Parser, Rasterizer, SVG
from PIL import Image  # for saving rasterized image
# Parse from a file
svg = Parser.parse_file('my_cool_img.svg')
print('Image is {} by {}.'.format(svg.width, svg.height))
rast = Rasterizer()
buff = rast.rasterize(svg, svg.width, svg.height)
im = Image.frombytes('RGBA', svg.width, svg.height, buff)
im.save('my_cool_img.png')  # save the converted image!

Metadata

Release files for pynanosvg 0.3.1

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

Source distribution (sdist)

Source distribution for pynanosvg 0.3.1
File Size Uploaded Provenance Actions
pynanosvg-0.3.1.tar.gz 346.0 kB Without provenance Details for pynanosvg-0.3.1.tar.gz

Release files / pynanosvg-0.3.1.tar.gz

Download URL pynanosvg-0.3.1.tar.gz
Size 346.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5e1a211d8778bf26c11d909b6905eff7822eea0abceda5eb294d5f6051f747d6
BLAKE2b-256 checksum
How to use checksums
f5c44488d5fd0798ac944effd4a0aab7e3e1b2a6e01816e6df850866970a2217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pynanosvg 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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