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

Examples

open allclose all

Basic Examples  (2)

Convert a color image into vector graphics:

Convert a natural image to vector graphics using 8 colors:

Scope  (3)

Convert a bitmap of a digit to vector graphics:

Convert a grayscale image to vector graphics:

By default, an automatic color quantization is performed:

Specify the number of colors to use:

Specify the explicit colors to use in the vector graphics:

Options  (3)

Method  (1)

Exact segment contours:

Simplified contours by connecting linearly separable segments:

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

Use marching squares:

Use dual marching squares:

MinColorDistance  (1)

By default, the minimum color distance is automatically chosen:

Specify a minimum color distance:

Smaller value for color distance results in more colors:

DistanceFunction  (1)

The color metric defined by DistanceFunction influences the image segmentation:

Applications  (4)

Create an outline image:

Simplify color regions using mean-shift and smooth outlines via curvature flow filter:

Convert to vector graphics:

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:

Delete county borders:

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:

Obtain a rough mask:

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:

Generate a vector graphic:

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:

Segment and select shapes:

Colorize the segmented image:

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:

Lower the color distance:

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:

Alternatively, use a high-resolution image:

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).

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

BibTeX

@misc{reference.wolfram_2024_imagegraphics, author="Wolfram Research", title="{ImageGraphics}", year="2018", howpublished="\url{https://reference.wolfram.com/language/ref/ImageGraphics.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_imagegraphics, organization={Wolfram Research}, title={ImageGraphics}, year={2018}, url={https://reference.wolfram.com/language/ref/ImageGraphics.html}, note=[Accessed: 21-November-2024 ]}