vpype is the Swiss-Army-knife command-line tool for plotter vector graphics.
vpype is the Swiss-Army-knife command-line tool for plotter vector graphics. Here is what it can do:
vpype is highly extensible through plug-ins that can greatly extend its capabilities. For example, plug-ins already exists for plotting pixel art, half-toning with hatches, and much more. See below for a list of existing plug-ins.
vpype is also a well documented Python library useful to create generative art and tools for plotters. It includes data structures, utility and I/O functions, as well as a hardware-accelerated flexible viewer for vector graphics. For example, the plotter generative art environment vsketch is built upon vpype.
Check the documentation for a more thorough introduction to vpype.
vpype works by building so-called pipelines of commands, where each command's output is fed to the next command's input.
Some commands load geometries into the pipeline (e.g. the
command which loads geometries from a SVG file). Other commands modify these geometries, e.g. by cropping
crop) or reordering them to minimize pen-up
linesort). Finally, some other commands
just read the geometries in the pipeline for display purposes (
or output to file (
Pipeline are defined using the vpype's CLI (command-line interface) in a terminal by typing
vpype followed by the
list of commands, each with their optional parameters and their arguments:
This pipeline uses five commands (in bold):
readloads geometries from a SVG file.
linemergemerges paths whose extremities are close to each other (within the provided tolerance).
linesortreorder paths such as to minimise the pen-up travel.
crop, well, crops.
writeexport the resulting geometries to a SVG file.
There are many more commands available in vpype, see the overview below.
Some commands have arguments, which are always required (in italic). For example, a file path must be provided to the
read command and dimensions must be provided to the
crop commands. A command may also have options which are, well,
optional. In this example,
--page-size a4 means that the
write command will generate a A4-sized SVG (otherwise it
would have the same size as in.svg). Likewise, because
--center is used, the
write command will center geometries
on the page before saving the SVG (otherwise the geometries would have been left at their original location).
Note: although it is not required, commands are separated by multiple spaces for clarity in the following examples.
Load an SVG file, scale it to a specific size, and export it centered on an A4-sized, ready-to-plot SVG file:
vpype read input.svg scaleto 10cm 10cm write --page-size a4 --center output.svg
Optimize paths to reduce plotting time (merge connected lines and sort them to minimize pen-up distance):
vpype read input.svg linemerge --tolerance 0.1mm linesort write output.svg
Visualize the path structure of large SVG files, showing whether lines are properly joined or not thanks to a colorful display:
vpype read input.svg show --colorful
Load several SVG files and save them as a single, multi-layer SVG file (e.g. for multicolored drawings):
vpype read -l 1 input1.svg read -l 2 input2.svg write output.svg
Create arbitrarily-sized, grid-like designs like this page's top banner:
vpype begin grid -o 1cm 1cm 10 13 script alien_letter.py scaleto 0.5cm 0.5cm end show
Export to HPGL for vintage plotters:
vpype read input.svg write --device hp7475a --page-size a4 --landscape --center output.hpgl
vpype caters to plotter generative art and does not aim to be a general purpose (think Illustrator/InkScape) vector graphic tools. One of the main reason for this is the fact vpype converts everything curvy (circles, bezier curves, etc.) to lines made of small segments. vpype also dismisses the stroke and fill properties (color, line width, etc.) of the imported graphics. These design choices make possible vpype's rich feature set, but makes its use for, e.g., printed media limited.
For Windows, an installer is available here (note: plug-ins cannot be installed when using this installation method).
For other platforms, and when plug-ins are required, vpype can be installed from the Python Package Index using the following command:
pip install vpype[all]
Note: a CLI-only version of vpype can be installed using
pip install vpype. This version does not include the
show command and skips the related dependencies (notably matplotlib, PySide2, and ModernGL).
Python must previously be installed. Python version 3.9.1 or later is recommended to use vpype, although it is also compatible with Python 3.6 and later.
Check the documentation for more details, in particular on how to use a virtual environment (recommended).
The vpype CLI includes its own, detailed documentation:
vpype --help # general help and command list vpype COMMAND --help # help for a specific command
In addition, the online documentation provides extensive background information on the fundamentals behind vpype, a cookbook covering most common tasks, the vpype API documentation, and much more.
vpype COMMAND --help) and support for arbitrary units (e.g.
vpype read input.svg translate 3cm 2in).
vpype COMMANDNAME --layer 1,3) and optionally-probabilistic layer edition commands (
vpype -H [...])
vpype -s 37 [...]).
Support for script-based generation (
Powerful and well-documented API for plug-ins and other plotter generative art projects.
Here is a list of known vpype plug-ins (please make a pull request if yours is missing):
vsketch: vsketch is complete framework for plotter generative artists implemented using vpype's API
vpype-pixelart: plot pixel art
hatched: half-toning with hatches
vpype-flow-imager: convert images to flow-line-based designs
occult: perform hidden line removal
vpype-explorations: my personal grab bag of experiments and utilities
vpype-gcode: flexible export command for gcode and other text-based format
vpype-dxf: read dxf files
vpype-embroidery: various embroidery-related utilities, including read from/write to most embroidery formats
vpype-vectrace: create outlines from images with vector tracing
Contributions to this project are welcome and do not necessarily require software development skills! Check the Contributing section of the documentation for more information.
This project is licensed under the MIT License - see the LICENSE file for details.