Skip to main content

API Reference Overview

Img2Num provides bindings for multiple languages. Choose the one that fits your workflow:

LanguageDocs
JS API Reference
C++ API Reference
C API Reference
Python API Reference

Common Concepts Across All Bindings

All APIs share these core concepts:

  1. Bilateral Filtering — Smooths noise while preserving edges.
  2. K-Means Clustering — Reduces the palette to k representative colors.
  3. Contour Tracing — Detects boundaries between color clusters.
  4. B-spline Simplification — Fits smooth quadratic curves to contours.

Shared Parameters

ParameterTypeDefaultDescription
sigma_spatial (σs\sigma_{s})float3Bilateral spatial sigma
sigma_range (σr\sigma_{r})float50Bilateral range sigma
num_colors / k (kk)int16Number of clusters
max_iterint100K-means iterations
min_areaint100Minimum contour area
color_spaceint00 = CIE LAB, 1 = sRGB

Pipeline Flow