ImageGraphics
ImageGraphics[image]
returns the content of image in the form of scalable vector graphics.
ImageGraphics[image,n]
uses up to n colors for the vector graphics.
ImageGraphics[image,colors]
creates vector graphics containing the specified colors.
Details and Options

- ImageGraphics is also known as image vectorization or auto tracing.
- ImageGraphics works with arbitrary 2D images and returns a Graphics object.
- ImageGraphics has the same options as Graphics, with the following changes and additions:
-
DistanceFunction Automatic any distance supported in ColorDistance Method Automatic method to determine color segment contours MinColorDistance Automatic minimum color distance - Possible settings for Method include:
-
"Exact" exact representation of the contour "LinearSeparable" approximate contour by local linear separation {"LinearSeparable",α} merge and smooth segments with direction changes smaller than α "MarchingSquares" contour computed using marching squares "DualMarchingSquares" contour computed using dual marching squares
Examples
open allclose allBasic Examples (2)
Scope (3)
Options (3)
Method (1)
MinColorDistance (1)
DistanceFunction (1)
The color metric defined by DistanceFunction influences the image segmentation:
Applications (4)
Simplify color regions using mean-shift and smooth outlines via curvature flow filter:
Successively simplify the color regions of an image with a mean-shift filter:
Generate vector graphic maps. Import a pixel-based map of the Rocky Mountains near Denver:
Convert colored elevation map into graphic contours:
Perform vector graphic operations introducing contour lines and changing colors:
Transform the map without altering line thickness:
Compare the result with the corresponding pixel-based transformation:
Creating a scalable icon of a kingfisher:
Refine the mask with the grow-cut algorithm:
Regularize the color segments via curvature flow:
Cover the background with green:
Select the dominant colors of the bird and add green as the background color:
Remove the green background segment:
Insert the expression into a larger graphic to obtain a scalable icon:
Properties & Relations (3)
Typically, the scalable graphics version of the image is much smaller in byte count:
ImageGraphics returns color segments similar to color quantization in the LAB color space:
Convert the image into vector graphics. Double-click to select and move a segment
Possible Issues (6)
"MarchingSquares" and "DualMarchingSquares" introduce gaps at T-junctions:
Segment edges in the resulting graphic are not colored:
Colorize the edges by providing explicit FaceForm and EdgeForm specifications:
Lines and curves of one-pixel thickness may not be detected correctly:
Make the lines thicker for a better conversion:
If the minimum color distance is larger than the image color variation, the output may be of a single color:
Segments touching across pixel corners are connected:
Use Method"MarchingSquares" to keep segments separated:
A low-resolution image may cause some pixelation artifacts:
Some of that artifact may be removed after image upsampling:
Text
Wolfram Research (2017), ImageGraphics, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageGraphics.html (updated 2018).
CMS
Wolfram Language. 2017. "ImageGraphics." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2018. https://reference.wolfram.com/language/ref/ImageGraphics.html.
APA
Wolfram Language. (2017). ImageGraphics. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageGraphics.html