Skip to main content

SVGReplicate

Tool for batch modifying and replicating SVG files.

Installation

Install from PyPI by running pip install svgreplicate.

Usage

Create an SVG file, either by hand or with your favorite vector graphics tool, like InkScape:

<svg
    width="210mm"
    height="297mm" 
    id="svg" 
    version="1.1"
    xmlns="http://www.w3.org/2000/svg" >
    <g id="group1">
        <ellipse
            style="opacity:1;fill:#009bff"
            id="ellipse1"
            cx="0.0"
            cy="0.0"
            rx="10.0"
            ry="10.0" />
        <g id="group2" />
    <text id="text1">
        <tspan>First text</tspan>
        <tspan>Second text 
            <tspan>Nested text</tspan> 
        </tspan>
    </text>
    </g>
</svg>

Next, create a json with the replicas you want:

[
    {
        "filename": "example/replica1.svg", 
        "modifications": [
        	{"id": "ellipse1", "style": {"fill": "#000000", "display": "none"}},
        	{"id": "group2", "style": {"display": "none"}},
        	{"id": "text1", "text": "Hello, world!"}
        ]
    },
    {
        "filename": "example/replica2.svg",
        "modifications": [
                {"id": "ellipse1", "style": {"fill": "#ffffff", "display": "none"}},
                {"id": "group2", "style": {"display": "none"}},
                {"id": "text1", "text": "Here's Johnny!"}
        ]
    }
]

And finally, run the script:

svgreplicate --filename path-to-svg-template.svg --replicas path-to-replicas-config.json 

You now have 2 files in the example folder, based on the template, with the specified modifications.

Backlog

In future, I'd like to add at least the functionality for automatically rendering to PNG.

Metadata

Release files for svgreplicate 0.1.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 svgreplicate 0.1.1
File Size Uploaded Provenance Actions
svgreplicate-0.1.1.tar.gz 3.7 kB Without provenance Details for svgreplicate-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 7.8 kB

Release files / svgreplicate-0.1.1.tar.gz

Download URL svgreplicate-0.1.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
116dd1686cb2a80baf673e25926ccf1911dcfec19b0b005fa8b427ac0081f938
BLAKE2b-256 checksum
How to use checksums
b980f687e444720565629298cd952c94f81f739080e293be7e86347711f375c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.2 Linux/5.13.0-35-generic

Release files / svgreplicate-0.1.1-py3-none-any.whl

Download URL svgreplicate-0.1.1-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
166563bda7789c99524750402993f4aa1f10ddc177b888debfe4b7c75e9f91cb
BLAKE2b-256 checksum
How to use checksums
7d214f9d2887d35976a45804959f5850437f82a84c23789286cc9a62ff388d58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.2 Linux/5.13.0-35-generic

Security for svgreplicate 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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