ComfyUI > Nodes > ComfyUI-ToSVG-Potracer > Potracer to SVG

ComfyUI Node: Potracer to SVG

Class Name

PotracerVectorize

Category
IMGNR
Author
ImagineerNL (Account age: 2211days)
Extension
ComfyUI-ToSVG-Potracer
Latest Updated
2025-05-08
Github Stars
0.02K

How to Install ComfyUI-ToSVG-Potracer

Install this extension via the ComfyUI Manager by searching for ComfyUI-ToSVG-Potracer
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-ToSVG-Potracer in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Potracer to SVG Description

Converts raster images to scalable SVGs using `potracer`, offering customizable vectorization options.

Potracer to SVG:

The PotracerVectorize node is designed to convert raster images into scalable vector graphics (SVG) format using the potracer library. This node is particularly beneficial for AI artists who wish to transform pixel-based images into vector-based graphics, which are resolution-independent and can be scaled without loss of quality. By leveraging the capabilities of potracer, this node traces the outlines of images and generates SVG files that can be easily manipulated and integrated into various design projects. The node supports a range of customization options, allowing you to adjust parameters such as threshold, turn policy, and curve optimization to achieve the desired vectorization results. This flexibility makes PotracerVectorize a powerful tool for creating clean and precise vector graphics from raster images.

Potracer to SVG Input Parameters:

image

The image parameter is the input raster image that you want to convert into an SVG. This parameter is essential as it provides the source material for vectorization. The image should be in a format compatible with the node, typically a tensor representation of an image.

threshold

The threshold parameter determines the cutoff value for distinguishing between foreground and background in the image. It ranges from 0 to 255, with a default value of 128. A lower threshold will result in more of the image being considered as foreground, while a higher threshold will reduce the amount of foreground detail captured.

turnpolicy

The turnpolicy parameter dictates how the tracing algorithm handles ambiguous situations where the path could turn in multiple directions. Options include "black", "white", "left", "right", "minority", and "majority". This parameter influences the shape and flow of the traced paths.

turdsize

The turdsize parameter specifies the minimum size of a feature to be retained in the vectorization process. Smaller features below this size will be ignored. This parameter helps in cleaning up the vector output by removing insignificant details.

corner_threshold

The corner_threshold parameter controls the sensitivity of the algorithm to corners in the image. A higher value will result in sharper corners, while a lower value will produce smoother curves.

opttolerance

The opttolerance parameter adjusts the tolerance for curve optimization. It affects how closely the vector paths follow the original image contours. A lower tolerance results in more accurate tracing but may increase the complexity of the SVG.

input_foreground

The input_foreground parameter specifies the color scheme of the input image, with options like "Black on White". This helps the algorithm determine which parts of the image are foreground and which are background.

optimize_curve

The optimize_curve parameter is a boolean that, when enabled, allows the algorithm to optimize curves for smoother results. This can be useful for reducing the complexity of the SVG while maintaining visual fidelity.

zero_sharp_corners

The zero_sharp_corners parameter is a boolean that, when enabled, reduces the sharpness of corners in the vector output. This can be useful for creating smoother, more flowing vector paths.

foreground_color

The foreground_color parameter sets the color of the foreground elements in the SVG. It is specified in hexadecimal format, with a default value of "#000000" (black).

background_color

The background_color parameter sets the color of the background in the SVG. It is specified in hexadecimal format, with a default value of "#ffffff" (white).

stroke_color

The stroke_color parameter defines the color of the stroke used in the SVG paths. It is specified in hexadecimal format, with a default value of "#ff0000" (red).

stroke_width

The stroke_width parameter specifies the width of the stroke in the SVG paths. A value of 0.0 means no stroke is applied.

no_background

The no_background parameter is a boolean that, when enabled, removes the background from the SVG output, leaving only the traced paths.

output_scale

The output_scale parameter determines the scaling factor for the SVG output. It allows you to adjust the size of the vector graphics, with a minimum value of 0.01 to ensure a positive scale.

save_svg_status_message

The save_svg_status_message parameter is a placeholder for potential future use or integration with other nodes. It currently does not affect the node's operation.

Potracer to SVG Output Parameters:

svg_string_deprecated

The svg_string_deprecated output provides the SVG data as a single string. This output is useful for applications that require SVG data in text format, although it is marked as deprecated in favor of more modern methods.

svg_ComfyUI_v0.3.32+

The svg_ComfyUI_v0.3.32+ output provides the SVG data as a list of BytesIO objects wrapped in an SVG class. This format is compatible with newer versions of ComfyUI and is preferred for its flexibility and ease of integration with other components.

Potracer to SVG Usage Tips:

  • Experiment with the threshold parameter to find the optimal balance between capturing detail and reducing noise in the vector output.
  • Use the turnpolicy parameter to influence the flow of paths in complex images, which can significantly affect the aesthetic of the final SVG.
  • Adjust the turdsize parameter to remove unwanted small features, which can help in simplifying the vector output and improving performance.

Potracer to SVG Common Errors and Solutions:

ERROR: Failed to load potracer. Check install (uninstall pypotrace, install potracer - see console) & restart ComfyUI.

  • Explanation: This error occurs when the potracer library is not properly installed or there is a conflict with the pypotrace library.
  • Solution: Ensure that pypotrace is uninstalled and potracer is installed using the command pip install potracer. Restart ComfyUI after making these changes.

Imported 'potrace' module, but 'potrace.Bitmap' not found.

  • Explanation: This error indicates that the potrace module was imported, but the expected Bitmap class is not available, possibly due to an incorrect library structure.
  • Solution: Verify the installation of the potracer library and ensure it is the correct version. Reinstall if necessary and check for any updates or documentation from the library maintainers.

Potracer to SVG Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-ToSVG-Potracer
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Potracer to SVG