Skip to main content

Official Python SDK for the VectoSolve API — AI-powered image vectorization, background removal, upscaling, and SVG generation.

Project description

VectoSolve Python SDK

Official Python client for the VectoSolve API — AI-powered image vectorization, background removal, upscaling, and SVG generation.

PyPI Python License: MIT

Installation

pip install vectosolve

Quick Start

from vectosolve import VectoSolve

client = VectoSolve(api_key="vs_your_api_key")

# Convert an image to SVG
result = client.vectorize("photo.png")
result.save("output.svg")
print(f"Credits remaining: {result.credits.remaining}")

Get your API key at vectosolve.com/dashboard.

Features

Method Description Credits
vectorize() Convert raster images (PNG, JPG, WebP) to clean SVG 1
remove_background() Remove image backgrounds with AI 1
upscale() AI-powered image upscaling (2x/4x) 1
generate_svg() Generate SVGs from text prompts 1
generate_logo() AI logo generation with multiple variants 1-2
generate_pattern() Generate seamless tileable patterns 1
batch() Process up to 10 images in a single request 1/image

Usage

Vectorize (Image to SVG)

# From a local file
result = client.vectorize("photo.png")
result.save("output.svg")

# From a URL
result = client.vectorize("https://example.com/image.png")
print(result.svg)  # Raw SVG string

Remove Background

result = client.remove_background("product.jpg")
print(result.image_url)  # URL of the processed image

Upscale

result = client.upscale("small-image.png")
print(result.image_url)

Generate SVG from Text

result = client.generate_svg(
    "a golden retriever playing fetch in a park",
    style="vector_illustration",
    size="1024x1024",
    colors=["#f4a460", "#228b22", "#87ceeb"],
)
result.save("dog.svg")

Available styles: vector_illustration, vector_illustration/line_art, vector_illustration/engraving, vector_illustration/linocut, vector_illustration/bold_stroke, vector_illustration/colored_stencil, vector_illustration/thin, vector_illustration/mosaic, vector_illustration/flat_2

Available sizes: 1024x1024, 1024x1536, 1536x1024

Generate Logo

result = client.generate_logo(
    "minimalist coffee shop logo with a steaming cup",
    model="v3",
    num_variants=4,
    colors=["#6f4e37", "#f5f5dc"],
)

for i, logo in enumerate(result.logos):
    logo.save(f"logo_{i}.svg")

Generate Pattern

result = client.generate_pattern(
    "tropical leaves and flowers",
    colors=["#2d5016", "#ff6b6b", "#ffd93d"],
)
print(result.image_url)

Batch Processing

result = client.batch([
    {"url": "https://example.com/photo1.png", "operation": "vectorize"},
    {"url": "https://example.com/photo2.jpg", "operation": "remove_bg"},
    {"url": "https://example.com/photo3.png", "operation": "upscale"},
])

for item in result.results:
    if item.success:
        print(f"[{item.index}] {item.operation}: {item.url}")
    else:
        print(f"[{item.index}] Failed: {item.error}")

print(f"Processed: {result.total_processed}, Failed: {result.total_failed}")

Environment Variable

Instead of passing the API key directly, you can set it as an environment variable:

export VECTOSOLVE_API_KEY="vs_your_api_key"
client = VectoSolve()  # Automatically reads VECTOSOLVE_API_KEY

Error Handling

from vectosolve import (
    VectoSolve,
    AuthenticationError,
    InsufficientCreditsError,
    RateLimitError,
    ValidationError,
)

client = VectoSolve(api_key="vs_your_api_key")

try:
    result = client.vectorize("image.png")
except AuthenticationError:
    print("Invalid API key")
except InsufficientCreditsError as e:
    print(f"Need {e.required} credits — top up at vectosolve.com/pricing")
except RateLimitError as e:
    print(f"Rate limited — retry after {e.retry_after}s")
except ValidationError as e:
    print(f"Bad request: {e.message}")

Context Manager

with VectoSolve(api_key="vs_your_api_key") as client:
    result = client.vectorize("photo.png")
    result.save("output.svg")
# Connection automatically closed

Use Cases

  • Cricut & Silhouette — Convert designs to cut-ready SVGs
  • Laser cutting — Vectorize artwork for laser engravers
  • Embroidery — Convert images for embroidery machines
  • E-commerce — Remove backgrounds from product photos
  • Design automation — Generate logos and patterns programmatically

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vectosolve-1.0.1.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vectosolve-1.0.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file vectosolve-1.0.1.tar.gz.

File metadata

  • Download URL: vectosolve-1.0.1.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for vectosolve-1.0.1.tar.gz
Algorithm Hash digest
SHA256 84859fdf1fb3246680d152b23f79405f3d61b2498d000970124bdf7a30b793f4
MD5 13656b01593ff9d9ab3292da1597d217
BLAKE2b-256 18f925ae80ecfda406f5b03c2da65a17bdb094c4d9528b726999b33abcacc5ef

See more details on using hashes here.

File details

Details for the file vectosolve-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: vectosolve-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for vectosolve-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e28a511b1e2fedd3fa8b19e0a2891bdfb897ea380b016d6fb508467120db75b
MD5 1b3bb43c2b83bb0d3e4794d2abbb3b0d
BLAKE2b-256 4ffb8d7dd63317f384427edb0f0ceb3d1457af8a84c7b79f316ad64deec6ad26

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page