shapesoda
Python client for the Shapesoda API: raster images (PNG, JPEG, WebP, BMP, GIF, TIFF) to SVG, PDF, EPS, DXF or PNG vectors. Python 3.9+.
pip install shapesoda
from shapesoda import Shapesoda, ShapesodaError
client = Shapesoda() # API key from SHAPESODA_API_KEY, or Shapesoda(api_key="ssk_...")
try:
# One call, one credit for all formats; files are saved as out/logo.svg and out/logo.pdf.
r = client.vectorize_file("logo.png", formats=["svg", "pdf"], preset="print", out_dir="out")
print(r.paths, r.response.credits_remaining)
except ShapesodaError as e:
if e.code == "no_credits":
print("Top up at https://shapesoda.com")
else:
raise
vectorize(bytes, **options)andvectorize_file(path, **options)send the image, then download every requested format intoresult.files(andout_dir). Options:formats,preset,image_type,quality,colors,detail,draw,layers,palette,width,height,unit,mode("test"is free and watermarked),out_dir,name, plus the fine-tuning options:max_colors,palette_tolerance,min_area,max_pixels,curve_tolerance,smoothness,corners,denoise,group_by,curves,stroke_width,stroke_color,stroke_scaling,gap_filler,gap_filler_width,aspect,align_x,align_y,scale,dpi,svg_version,svg_fixed_size,adobe_compat,dxf_curves,png_antialiasandretention_days(1–30 days instead of 24 hours, free). A preset only sets defaults; every option you pass wins. Ranges and combination rules: https://shapesoda.com/api#parameters.preview(bytes, **options)/preview_file(path, **options): a free PNG up to 1 MP (result.files["png"]), 200 per account per day. When the user is happy,upgrade(result, formats=["svg"])builds the vectors from the stored image for 1 credit (credits_charged), with no new upload; other formats are free afterwards.- Errors are
ShapesodaErrorwithcode(unauthorized,no_credits,rate_limited,invalid_image, …, ornetwork),status,request_idandretry_after. - After
429or503withRetry-Afterthe call is retried up to 5 times (max_retries); a wait longer thanmax_retry_wait(60 s) and the daily limits are not retried. download(result_id, result_token, format),delete_result(...)andaccount()are there too; the generated low-level client isshapesoda.core(packageshapesoda_core).
The SDK always sends Accept: application/json, so the API answers with links to the stored result (kept for 24 hours, encrypted with the result_token only you get) and the files are downloaded with that token. Reference: https://shapesoda.com/api.
shapesoda_core/ is generated by openapi-generator from the public OpenAPI spec; do not edit it by hand (see clients/sdk/README.md).
Metadata
Release files for shapesoda 1.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 | |
|---|---|---|---|
| shapesoda-1.1.0.tar.gz | 43.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shapesoda-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 114.8 kB
Release files / shapesoda-1.1.0.tar.gz
| Download URL | shapesoda-1.1.0.tar.gz |
|---|---|
| Size | 43.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7308ef0635633d98175c8d528ed3a5c65aadf32481fa1522199c03442fa7e0b3
|
|
BLAKE2b-256 checksum How to use checksums |
6a61b7b491842e464e72dca2564378ef9461bfa216f6960da4475ebea527933e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / shapesoda-1.1.0-py3-none-any.whl
| Download URL | shapesoda-1.1.0-py3-none-any.whl |
|---|---|
| Size | 71.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c1bd70300838b3bf776004d3b913bf148340caaf9c800ca4c35f889ccd921da
|
|
BLAKE2b-256 checksum How to use checksums |
2f9fbc55c64929a7bb94720ef05b45390e93faf63b0e7dcc0fae769e6e7827f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|