Skip to main content

penkit-optimize is a command-line tool for optimizing and visualizing the drawing order of SVG graphics for pen plotting. For more information, see this post.

Installation

This package has a non-Python dependency, libspatialindex. The easiest way to install it is by installing the rtree Python package via Conda:

conda install rtree

Once this is installed, penkit-optimize can be installed via pip:

pip install penkit-optimize

Usage

To see CLI options:

penkit-optimize -h
    usage: penkit-optimize [-h] [--greedy] [--noopt] [--runtime RUNTIME]
                           [--merge-paths [MERGE_PATHS]] [--vis-output VIS_OUTPUT]
                           input_file [output_file]

    positional arguments:
    input_file
    output_file

    optional arguments:
    -h, --help            show this help message and exit
    --greedy, -g          Run greedy optimization only.
    --noopt, -n           Don't run any optimization.
    --runtime RUNTIME, -t RUNTIME
                          Maximum runtime (in seconds) of optimization stage.
    --merge-paths [MERGE_PATHS], -m [MERGE_PATHS]
                          Merge paths that start/end near each other. You may
                          optionally specify a threshold distance (in document
                          units) after this parameter.
    --vis-output VIS_OUTPUT, -v VIS_OUTPUT
                          If provided, save a visualization of the path to this
                          SVG file.

Examples

Generate optimized SVG with default options (up to 5 minute runtime), and save to input-optimized.svg:

penkit-optimize input.svg

Don’t optimize anything, just visualize the transits:

penkit-optimize input.svg -n -v noopt-vis.svg

noopt-vis.svg:

examples/noopt-vis.svg

Run greedy optimization (only), save the file, and save a visualization of the result:

penkit-optimize input.svg output.svg -g -v greedy-vis.svg

greedy-vis.svg:

examples/greedy-vis.svg

Run the full optimization and write a visualization of the result:

penkit-optimize input.svg output.svg -v opt-vis.svg

opt-vis.svg:

examples/opt-vis.svg

Run the full optimization and merge paths that start/end within 1.5 units:

penkit-optimize input.svg -m 1.5

Metadata

Release files for penkit-optimize 0.0.3

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

Source distribution (sdist)

Source distribution for penkit-optimize 0.0.3
File Size Uploaded Provenance Actions
penkit-optimize-0.0.3.tar.gz 8.0 kB Without provenance Details for penkit-optimize-0.0.3.tar.gz

Release files / penkit-optimize-0.0.3.tar.gz

Download URL penkit-optimize-0.0.3.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
34b1b129cf8ee5e324f1514483a6e346fb3b345f703f8305f1dbdde89ee08535
BLAKE2b-256 checksum
How to use checksums
a3d0f0c1a5a969a292b5ef4b4473d34c424a4c34b6193006faa039766cc57257
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

Security for penkit-optimize 0.0.3

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.0.3 This release

1 release file 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