Maven module :un.api : api-image :
Class :
un.impl.image.process.analyze.ImageTraceOperator
Extends/Implements :
un.api.task.AbstractTask
Subclasses : -
Variables :
INPUT_LTRES,
INPUT_QTRES,
INPUT_PATHOMIT,
INPUT_NUMBER_OF_COLORS,
INPUT_LCPR,
INPUT_QCPR,
OUTPUT_SVG,
DESCRIPTOR
Functions :
ImageTraceOperator,
execute
public ParameterValueType
INPUT_LTRES
public ParameterValueType
INPUT_QTRES
public ParameterValueType
INPUT_PATHOMIT
public ParameterValueType
INPUT_NUMBER_OF_COLORS
public ParameterValueType
INPUT_LCPR
public ParameterValueType
INPUT_QCPR
public ParameterValueType
OUTPUT_SVG
public DefaultImageTaskDescriptor
DESCRIPTOR
public void
ImageTraceOperator ()
public Parameters
execute ()
Simple raster image tracer and vectorizer written in Java. This is a port of imagetracer.js.
by AndrĂ¡s Jankovics 2015
andras@jankovics.net
Tips:
- color quantization uses randomization to recycle little used colors when colorquantcycles > 1 ,
which means that output will be different every time. Use colorquantcycles = 1 to get deterministic output.
- palette generation uses randomization to make some of the colors. Set numberofcolors to a qubic number
(e.g. 8, 27 or 64) to get a deterministic palette, or use a custom palette.
- ltres,qtres : lower linear (ltres) and quadratic spline (qtres) error tresholds result
more details at the cost of longer paths (more segments). Usually 0.5 or 1 is good for both. When tracing
round shapes, lower ltres, e.g. ltres=0.2 qtres=1 will result more curves, thus maybe better quality. Similarly,
ltres=1 qtres=0 is better for polygonal shapes. Values greater than 2 will usually result inaccurate paths.
- pathomit : the length of the shortest path is 4, four corners around one pixel. The default pathomit=8 filters out
isolated one and two pixels for noise reduction. This can be deactivated by setting pathomit=0.
- pal, numberofcolors : custom palette in the format pal=[colornum][4]; or automatic palette
with the given length. Many colors will result many layers, so longer processing time and more paths, but better
quality. When using few colors, more colorquantcycles can improve quality.
- mincolorratio : minimum ratio of pixels, below this the color will be randomized. mincolorratio=0.02 for a 10*10 image
means that if a color has less than 10*10 * 0.02 = 2 pixels, it will be randomized.
- colorquantcycles : color quantization will be repeated this many times. When using many colors, this can be a lower value.
- scale : optionally, the SVG output can be scaled, scale=2 means the SVG will have double height and width
Process overview
----------------
// 1. Color quantization
// 2. Layer separation and edge detection
// 3. Batch pathscan
// 4. Batch interpollation
// 5. Batch tracing
// 6. Creating SVG string
Origin :
https://github.com/jankovicsandras/imagetracerjava
@author jankovics andras (andras@jankovics.net)
@author Johann Sorel (Adapted to Unlicense-lib)