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:


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:

  1. Submit vectorization request
  2. Check vectorization status
  3. Download the vectorized file

Vectorization Options Explained

OptionDescription
ErrorThresholdDetermines the acceptable error level for vectorization precision (lower value = higher accuracy).
MaxIterationsSets the maximum iterations the algorithm performs during vectorization (higher = potentially higher accuracy but slower processing).
ColorLimitLimits the number of colors used in the resulting vector image.
LineWidthDefines the width of lines in the vectorized output.

See Also