shapesoda
Python client for the Shapesoda API: raster images (PNG, JPEG, WebP, BMP, GIF, TIFF) to SVG, PDF, EPS or DXF vectors, or a rendered PNG. 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.2.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.2.0.tar.gz | 49.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shapesoda-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 125.7 kB
Release files / shapesoda-1.2.0.tar.gz
| Download URL | shapesoda-1.2.0.tar.gz |
|---|---|
| Size | 49.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8dccf2bb343578c54489d8e95005d5fafd56cc8cd3d94951b03db38a1ece4c87
|
|
BLAKE2b-256 checksum How to use checksums |
03131ea108ed5e76a6227970ac4d5cf724df98c8889e3f3add7bd9c4987e7c6b
|
| 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.2.0-py3-none-any.whl
| Download URL | shapesoda-1.2.0-py3-none-any.whl |
|---|---|
| Size | 76.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59be77680c8fed49bd31bd159cf2762232892968cd461e4841b291614e7b62be
|
|
BLAKE2b-256 checksum How to use checksums |
c87ee62d6292963438181dbcf020e0f79710790bd0a0531c4110697f627b6387
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|