Drawing generator from a photo

Generate kinds of aquarelle with the photo to svg generator tool is very easy.

  • It is achieved by reducing the dimensions of the photo and its number of colors.
  • Then by extraction of the contours of the colors with filtering and smoothing of the vertices.

Color quantization

A photo can include a large number of distinct colors, the objective of quantification is to constitute a determined number of groups of close colors to calculate the average color of each group and thus configure the image transformation color palette.
The color of each pixel in the image is then assigned to the closest color in the palette.
The quantization algorithm calculates the distances between colors in a three-dimensional space:

  • the HSV (Hue Saturation Value) cylinder
  • or the RGB (Red Green Blue) cube
the HSV cylinder

The HSV cylinder

the RGB cube

The RGB cube


Depends of the image HSV space can delivers better results.
Try the two modes to choose the better.

Apply the palette

The default palette provides a minimum distance between colors of 5 in deltaE unit.
Use the default palette or define the number of colors and compute the palette.
Then apply the chosen palette:

the original photo

The original photo

the transformed photo with 16 colors

the transformed photo with 16 HSV colors palette

Merge pixels

The merge operation affects the color of one pixel to its adjacent, if the distance from its color to that of the adjacent is less than the chosen distance in deltaE unit.
The deltaE distance is such that a gap of less than 5 is not visible from the eye.

The 16 colors photo before merging

The 16 colors photo before merging

the merged photo

the merged photo with a distance of 5

Generate the drawing

The drawing is generated by extracting the outlines of equals color areas, then filtering the vertices and finally smoothing the vectors.
Each color path are drawn in a dedicated layer.
Layers are generated in descending order of pixel count with a few options:

  • Generate overlapped layers
    Each layer is extended to cover the following ones, otherwise the layers are disjointed and adjacent by their contours. This generally simplifies outlines by removing holes and removes stroke effects at layer boundaries.
  • First layer drawn as background rectangle
    This option reduces the size of the file produced with the dominant color in the background.
  • Filter vertices with specified distance
    This option simplifies the contours by removing unnecessary points (point with a distance to the chord less than the threshold) and removes staircase effects.
  • Smooth the vectors
    The contours are smoothed by substitution of the vectors with cubic or quadratic arcs depending on the curvature. If the layers are generated disjointed, only the concave portions of the contours are smoothed.
the transformed photo to be vectorized

The transformed photo to be vectorized

Raw contours without filters or smoothing

Raw contours without filters or smoothing

Filtered contours by a distance of 4

Filtered contours by a distance of 4

Smoothed contours

Smoothed contours