justvectorize
Vectorize images from Python or the command line. Turn PNG, JPG and WebP into SVG, PDF, EPS, AI or DXF with the JustVectorize API.
- Sync and async clients, fully typed: your editor autocompletes every tracer option
- Every documented option: palettes, color limits, background removal, stroke styles for cutters and plotters, output sizing
- Automatic retries on rate limits and transient errors
- A CLI for one-off and batch conversions
1. Get an API key
The package calls the JustVectorize API, so you need a key:
- Sign in at justvectorize.com/account.
- Open the API keys panel and create a key.
- Put it in an environment variable:
export JUSTVECTORIZE_API_KEY=jv_live_xxxxxxxxxxxxxxxxxxxxxxxx
One production trace costs one credit. image_mode="test" is free, so you can integrate before you subscribe. See pricing.
Keep the key server-side. It spends your credits. Use it from your backend or scripts, and never commit it.
2. Install
pip install justvectorize
Requires Python 3.10 or newer.
3. Vectorize
from justvectorize import JustVectorize
client = JustVectorize(api_key="jv_live_...") # or JustVectorize() to read JUSTVECTORIZE_API_KEY
# Trace and save. The format comes from the extension.
client.vectorize_to_file("logo.png", "logo.svg", max_colors=4, remove_bg=True)
Methods
| Method | Returns |
|---|---|
vectorize(image, **options) |
VectorizeResult: file_url (a temporary download link, about 30 days), operation_id, format |
vectorize_to_bytes(image, **options) |
VectorizeFileResult: the above plus data (bytes) and content_type |
vectorize_to_string(image, **options) |
the file as text, e.g. SVG markup |
vectorize_to_file(image, out_path, **options) |
writes the file (creating folders), returns the result with path |
image can be a file path (str or Path), an http(s) URL, bytes, or a file opened in binary mode.
Every method also takes file_name= (the upload's name) and timeout= (seconds).
There's also a shorthand that reads the key from the environment:
from justvectorize import vectorize
print(vectorize("photo.jpg", format="pdf").file_url)
Examples
# Inline SVG markup
svg = client.vectorize_to_string(image_bytes, format="svg", n_colors=3)
# A laser / plotter cut file: one stroke per edge, real-world units
client.vectorize_to_file(
"sketch.jpg", "sketch.dxf",
draw_style="stroke_edges", dxf_units="mm", width=100, unit="mm",
)
# Lock output to brand colors
client.vectorize_to_file(
"logo.png", "logo.pdf",
palette=["#000000", {"color": "#ff5c00", "tolerance": 0.1}],
)
# Free test trace while you integrate
client.vectorize("logo.png", image_mode="test")
Options use the API's own names. The full list is in the parameter reference.
Async
from justvectorize import AsyncJustVectorize
async with AsyncJustVectorize() as client:
await client.vectorize_to_file("logo.png", "logo.svg")
Client options
JustVectorize(
api_key="jv_live_...", # default: os.environ["JUSTVECTORIZE_API_KEY"]
timeout=120.0, # seconds per request
max_retries=2, # on 429, 5xx and network errors
http_client=None, # your own httpx.Client (proxies, custom transport)
)
Use it as a context manager (with JustVectorize() as client:) or call client.close() to release connections.
Errors
Failures raise JustVectorizeError with the HTTP status:
from justvectorize import JustVectorizeError
try:
client.vectorize("logo.png")
except JustVectorizeError as error:
if error.status == 402:
... # out of credits
| Status | Meaning |
|---|---|
| 400 | No file, not an image, or bad palette JSON |
| 401 | Missing, invalid or revoked API key |
| 402 | Out of API credits |
| 413 | Image over 20 MB |
| 422 | An option is the wrong type, out of range or unknown |
| 429 / 5xx | Retried automatically, then raised |
Failed requests are not charged.
CLI
justvectorize logo.png # → logo.svg
justvectorize logo.png -o logo.pdf --max-colors 3 --remove-bg
justvectorize sketch.jpg -f dxf --draw-style stroke_edges --dxf-units mm
justvectorize *.png -o vectors/ --image-mode test # batch, free
justvectorize logo.png --url # print the link only
The CLI reads JUSTVECTORIZE_API_KEY, or takes --api-key. It accepts any tracer option as --kebab-case or --snake_case. Run justvectorize --help to see them all. python -m justvectorize.cli works too.
Links
- API docs
- Pricing
- Node.js:
@algora-ventures/justvectorize - Support: contact@justvectorize.com
MIT © Algora Ventures Limited
Metadata
Release files for justvectorize 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| justvectorize-0.1.0.tar.gz | 13.7 kB | Without provenance | Details for justvectorize-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| justvectorize-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for justvectorize-0.1.0-py3-none-any.whl |
Total release size: 28.4 kB
Release files / justvectorize-0.1.0.tar.gz
| Download URL | justvectorize-0.1.0.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79f9996c53dda6f9524599c94a2865109d1b4b17d59ab6e8dd6825b9453e12c4
|
|
BLAKE2b-256 checksum How to use checksums |
7e4e900850a517bdaf80e86367a847591617e7dcf1a7b23af9f77e8eb035443d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Release files / justvectorize-0.1.0-py3-none-any.whl
| Download URL | justvectorize-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8ab4cd65835686a6373b51bf79622f71923620728f0ed4229594117883af19f
|
|
BLAKE2b-256 checksum How to use checksums |
18171ef839d46ddf71d93b9885efa4ea19a974bef1528535fbd087591d80263e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Security for justvectorize 0.1.0
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.