Image Vectorization – Aspose.HTML Cloud
This article explains how to vectorize raster images using Aspose.HTML Cloud API from URL sources in synchronous and asynchronous modes. Supported image formats for vectorization include PNG, JPEG, JPG, BMP, GIF, and WEBP. The vectorized files are always produced in SVG format.
Before starting, ensure you have obtained an authorization token. Refer to the Authorization Guide for details.
Vectorization Methods
Aspose.HTML Cloud provides two vectorization methods:
- Synchronous Vectorization: Ideal for smaller images; the result is directly returned in the response.
- Asynchronous Vectorization: Best suited for larger images; the task runs in the background, and the result is downloaded upon completion.
1. Synchronous Vectorization
Endpoint: POST https://api.aspose.cloud/v4.0/html/vectorization/png/sync
Authorization: Bearer token
Request Body:
1{
2 "InputPath": "https://example.com/image.png",
3 "Options": {
4 "ErrorThreshold": 30,
5 "MaxIterations": 100,
6 "ColorLimit": 16,
7 "LineWidth": 1.5
8 }
9}
Response: The API returns the vectorized SVG file directly.
2. Asynchronous Vectorization
Steps:
- Submit vectorization request
- Check vectorization status
- Download the vectorized file
Vectorization Options Explained
Option | Description |
---|---|
ErrorThreshold | Determines the acceptable error level for vectorization precision (lower value = higher accuracy). |
MaxIterations | Sets the maximum iterations the algorithm performs during vectorization (higher = potentially higher accuracy but slower processing). |
ColorLimit | Limits the number of colors used in the resulting vector image. |
LineWidth | Defines the width of lines in the vectorized output. |