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: [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)
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