Package to convert SVG paths to CSV data and LaTeX commands
Project description
PySvg2Csv
Amit M. Manthanwar 24 September 2025
pip3 install tex2svg
Introduction
PySvg2Csv is a package for graphic object conversion and data transformation with Python. This simple program converts graphic paths from an SVG file to a corresponding CSV data file and equivalent Bézier paths used by LaTeX's Postscript package pstricks.
It provides:
- a powerful data extraction and format conversion capabilities
- sophisticated (transformation) functions
- tools for integrating LaTeX, PostScript, and JavaScript code
Description
The path element is the most powerful element in the SVG library of basic shapes. It can be used to create lines, curves, arcs, and more. There are three different commands that can be used to create smooth curves. Two of those curves are Bézier curves, and the third is an "arc" or part of a circle. There are an infinite number of Bézier curves, but only two are available in path elements: a cubic one, called with C, and a quadratic one, called with Q. A Bézier curve is a mathematically defined, smooth curve used in computer graphics, design, and animation, determined by a set of discrete control points. These control points dictate the curve's shape, with the curve passing through the first and last points but being "pulled" toward the intermediate points. The cubic curve, C, also known as the Cubic Bézier take in two control points for each point. Therefore, to create a cubic Bézier, three sets of coordinates need to be specified. Including the starting point there are four points for any given cubic Bézier path. The endever is to extract these points for every path in the SVG file and store them as CSV data and LaTeX PSTricks commands.
Quick Start
from pysvg2csv.svg2csv import *
node_coords = extract_node_coordinates("data-svg/weapon-trident-01.svg")
print("Node Coordinates:", *node_coords, sep='\n')
latex_paths = create_latex_paths(node_coords)
print("LaTeX Paths:", *latex_paths, sep='\n')
Testing
PySvg2Csv requires pytest and pytest-cov. Tests can then be run after installation with:
pytest
pytest --cache-clear
pytest --cov=your_module_or_directory
pytest --cov=tests --cov-report=html:coverage_html_report
Code of Conduct
PySvg2Csv is a community-driven open source project developed by a diverse group of contributors. The PySvg2Csv leadership has made a strong commitment to creating an open, inclusive, and positive community. Please read the PySvg2Csv Code of Conduct for guidance on how to interact with others in a way that makes our community thrive.
Call for Contributions
The PySvg2Csv project welcomes your expertise and enthusiasm!
Small improvements or fixes are always appreciated. If you are considering larger contributions to the source code, please contact us by emailing.
Writing code isn’t the only way to contribute to PySvg2Csv. You can also:
- review pull requests
- help us stay on top of new and old issues
- develop tutorials, presentations, and other educational materials
- maintain and improve our website
- develop graphic design for our projects and promotional materials
- translate website content
- help with outreach and onboard new contributors
- write grant proposals and help with other fundraising efforts
For more information about the ways you can contribute to PySvg2CSV, visit our website. If you’re unsure where to start or how your skills fit in, reach out! You can ask on the mailing list or here, on GitHub, by opening a new issue or leaving a comment on a relevant issue that is already open.
Our preferred channels of communication are all public, but if you’d like to speak to us in private first, contact our community coordinators at PySvg2Csv-team@googlegroups.com or on Slack (write PySvg2Csv-team@googlegroups.com for an invitation).
We also have a biweekly community call, details of which are announced on the mailing list. You are very welcome to join.
If you are new to contributing to open source, this guide helps explain why, what, and how to successfully get involved.
Feel free to ask questions, post issues, submit pull request, and request new features.
For more information about this project and how to use this package, please check out our detailed documentation.
Languages we support
Support this work
Support this project and its continued development, by sponsoring us!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysvg2csv-2025.9.24.tar.gz.
File metadata
- Download URL: pysvg2csv-2025.9.24.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69f75cd3945b411904e6e90d35a7a579803d2b44b110277a3cebd8103250004c
|
|
| MD5 |
bb0538e05c3767587c6908355ce16e67
|
|
| BLAKE2b-256 |
d9172e9db0d8b155541528f5f5a36a1fc014cf7680f52c86f82c9c752228b20a
|
File details
Details for the file pysvg2csv-2025.9.24-py3-none-any.whl.
File metadata
- Download URL: pysvg2csv-2025.9.24-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4ebebc5d8c344ed2cee4bba44b7c78ba3ade64ca33d6aa4b7a0730f3155bc32
|
|
| MD5 |
b076dcf8eae90084628094c9e2761fd3
|
|
| BLAKE2b-256 |
2e0aed2e7abf82cdc0caf470484ebe198667b5c12356bc0e22c69f8ba299fd87
|