ImageGraphics
✖
ImageGraphics
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: [List of all options]
-
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 -
AlignmentPoint Center the default point in the graphic to align with AspectRatio Automatic ratio of height to width Axes False whether to draw axes AxesLabel None axes labels AxesOrigin Automatic where axes should cross AxesStyle {} style specifications for the axes Background None background color for the plot BaselinePosition Automatic how to align with a surrounding text baseline BaseStyle {} base style specifications for the graphic ContentSelectable Automatic whether to allow contents to be selected CoordinatesToolOptions Automatic detailed behavior of the coordinates tool DistanceFunction Automatic any distance supported in ColorDistance Epilog {} primitives rendered after the main plot FormatType TraditionalForm the default format type for text Frame False whether to put a frame around the plot FrameLabel None frame labels FrameStyle {} style specifications for the frame FrameTicks Automatic frame ticks FrameTicksStyle {} style specifications for frame ticks GridLines None grid lines to draw GridLinesStyle {} style specifications for grid lines ImageMargins 0. the margins to leave around the graphic ImagePadding All what extra padding to allow for labels etc. ImageSize Automatic the absolute size at which to render the graphic LabelStyle {} style specifications for labels Method Automatic method to determine color segment contours MinColorDistance Automatic minimum color distance PlotLabel None an overall label for the plot PlotRange All range of values to include PlotRangeClipping False whether to clip at the plot range PlotRangePadding Automatic how much to pad the range of values PlotRegion Automatic the final display region to be filled PreserveImageOptions Automatic whether to preserve image options when displaying new versions of the same graphic Prolog {} primitives rendered before the main plot RotateLabel True whether to rotate y labels on the frame Ticks Automatic axes ticks TicksStyle {} style specifications for axes ticks
List of all options



Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Scope (3)Survey of the scope of standard use cases
Convert a bitmap of a digit to vector graphics:

https://wolfram.com/xid/0cg4t6mdu-svosaa

Convert a grayscale image to vector graphics:

https://wolfram.com/xid/0cg4t6mdu-yygywp

By default, an automatic color quantization is performed:

https://wolfram.com/xid/0cg4t6mdu-pzq4um

https://wolfram.com/xid/0cg4t6mdu-iyb1mn

Specify the number of colors to use:

https://wolfram.com/xid/0cg4t6mdu-jz1ylr

Specify the explicit colors to use in the vector graphics:

https://wolfram.com/xid/0cg4t6mdu-w8301t

Options (3)Common values & functionality for each option
Method (1)

https://wolfram.com/xid/0cg4t6mdu-qrlqh6

https://wolfram.com/xid/0cg4t6mdu-insg7w

Simplified contours by connecting linearly separable segments:

https://wolfram.com/xid/0cg4t6mdu-7eyd9l

Smooth contours by rounding corners of less than 90° with Bézier splines:

https://wolfram.com/xid/0cg4t6mdu-fy04ut


https://wolfram.com/xid/0cg4t6mdu-82dews


https://wolfram.com/xid/0cg4t6mdu-fapz17

MinColorDistance (1)
By default, the minimum color distance is automatically chosen:

https://wolfram.com/xid/0cg4t6mdu-tcd5qu

https://wolfram.com/xid/0cg4t6mdu-9l5gun

Specify a minimum color distance:

https://wolfram.com/xid/0cg4t6mdu-ncrw9h

Smaller value for color distance results in more colors:

https://wolfram.com/xid/0cg4t6mdu-ydei9f

DistanceFunction (1)
The color metric defined by DistanceFunction influences the image segmentation:

https://wolfram.com/xid/0cg4t6mdu-77xkoi

https://wolfram.com/xid/0cg4t6mdu-6kj4p4


https://wolfram.com/xid/0cg4t6mdu-tqsohz

Applications (4)Sample problems that can be solved with this function

https://wolfram.com/xid/0cg4t6mdu-tb89ld
Simplify color regions using mean-shift and smooth outlines via curvature flow filter:

https://wolfram.com/xid/0cg4t6mdu-51cjwn


https://wolfram.com/xid/0cg4t6mdu-9ex19x

Successively simplify the color regions of an image with a mean-shift filter:

https://wolfram.com/xid/0cg4t6mdu-h7xk4u

https://wolfram.com/xid/0cg4t6mdu-ejsfis


https://wolfram.com/xid/0cg4t6mdu-nktsua

Generate vector graphic maps. Import a pixel-based map of the Rocky Mountains near Denver:

https://wolfram.com/xid/0cg4t6mdu-d6h85p


https://wolfram.com/xid/0cg4t6mdu-67rjb1

Convert colored elevation map into graphic contours:

https://wolfram.com/xid/0cg4t6mdu-q36jo6

Perform vector graphic operations introducing contour lines and changing colors:

https://wolfram.com/xid/0cg4t6mdu-0td8rf

Transform the map without altering line thickness:

https://wolfram.com/xid/0cg4t6mdu-ntb47m

https://wolfram.com/xid/0cg4t6mdu-h5hy2f

Compare the result with the corresponding pixel-based transformation:

https://wolfram.com/xid/0cg4t6mdu-t0ft72

Creating a scalable icon of a kingfisher:

https://wolfram.com/xid/0cg4t6mdu-ltipw2

https://wolfram.com/xid/0cg4t6mdu-d6078c

Refine the mask with the grow-cut algorithm:

https://wolfram.com/xid/0cg4t6mdu-5erq3d

Regularize the color segments via curvature flow:

https://wolfram.com/xid/0cg4t6mdu-fghoty

Cover the background with green:

https://wolfram.com/xid/0cg4t6mdu-5ofx0k

Select the dominant colors of the bird and add green as the background color:

https://wolfram.com/xid/0cg4t6mdu-b12pj0


https://wolfram.com/xid/0cg4t6mdu-h9wazl

Remove the green background segment:

https://wolfram.com/xid/0cg4t6mdu-34ty4y

Insert the expression into a larger graphic to obtain a scalable icon:

https://wolfram.com/xid/0cg4t6mdu-y1dlvr

Properties & Relations (3)Properties of the function, and connections to other functions
Typically, the scalable graphics version of the image is much smaller in byte count:

https://wolfram.com/xid/0cg4t6mdu-iebkfh

https://wolfram.com/xid/0cg4t6mdu-51j1pp


https://wolfram.com/xid/0cg4t6mdu-ov2jld

ImageGraphics returns color segments similar to color quantization in the LAB color space:

https://wolfram.com/xid/0cg4t6mdu-l1pzuw

https://wolfram.com/xid/0cg4t6mdu-g9ditm


https://wolfram.com/xid/0cg4t6mdu-105zs0


https://wolfram.com/xid/0cg4t6mdu-7qjlkd


https://wolfram.com/xid/0cg4t6mdu-63lhhd

https://wolfram.com/xid/0cg4t6mdu-2luy7l

Convert the image into vector graphics. Double-click to select and move a segment

https://wolfram.com/xid/0cg4t6mdu-7pbmlu

Possible Issues (6)Common pitfalls and unexpected behavior
"MarchingSquares" and "DualMarchingSquares" introduce gaps at T-junctions:

https://wolfram.com/xid/0cg4t6mdu-uzrlcp

Segment edges in the resulting graphic are not colored:

https://wolfram.com/xid/0cg4t6mdu-l4tumt

https://wolfram.com/xid/0cg4t6mdu-bo89ke

Colorize the edges by providing explicit FaceForm and EdgeForm specifications:

https://wolfram.com/xid/0cg4t6mdu-bex1dk

Lines and curves of one-pixel thickness may not be detected correctly:

https://wolfram.com/xid/0cg4t6mdu-h979qc

https://wolfram.com/xid/0cg4t6mdu-naqso5

Make the lines thicker for a better conversion:

https://wolfram.com/xid/0cg4t6mdu-25xht9

If the minimum color distance is larger than the image color variation, the output may be of a single color:

https://wolfram.com/xid/0cg4t6mdu-5xkzja


https://wolfram.com/xid/0cg4t6mdu-epj33a

Segments touching across pixel corners are connected:

https://wolfram.com/xid/0cg4t6mdu-m56uri

Use Method"MarchingSquares" to keep segments separated:

https://wolfram.com/xid/0cg4t6mdu-mjqoo

A low-resolution image may cause some pixelation artifacts:

https://wolfram.com/xid/0cg4t6mdu-6qdqdo

Some of that artifact may be removed after image upsampling:

https://wolfram.com/xid/0cg4t6mdu-djs75b

Alternatively, use a high-resolution image:

https://wolfram.com/xid/0cg4t6mdu-8k28uu

Wolfram Research (2017), ImageGraphics, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageGraphics.html (updated 2018).
Text
Wolfram Research (2017), ImageGraphics, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageGraphics.html (updated 2018).
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.
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
Wolfram Language. (2017). ImageGraphics. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageGraphics.html
BibTeX
@misc{reference.wolfram_2025_imagegraphics, author="Wolfram Research", title="{ImageGraphics}", year="2018", howpublished="\url{https://reference.wolfram.com/language/ref/ImageGraphics.html}", note=[Accessed: 25-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_imagegraphics, organization={Wolfram Research}, title={ImageGraphics}, year={2018}, url={https://reference.wolfram.com/language/ref/ImageGraphics.html}, note=[Accessed: 25-May-2025
]}