Nodes/ComfyUI_SVG-Suite/SVG Path Manipulation
ComfyUI Node

SVG Path Manipulation

Flip, rotate, scale, and simplify paths — no geometry apps needed

By MushroomFleet·Created about a year ago·Updated 5 months ago· 9
SVG Path Manipulation
    • STRING
    ◄svg_string—►
    â—„operationscaleâ–º
    â—„scale_x1.5â–º
    â—„scale_y1.5â–º
    â—„rotation_degrees45â–º
    â—„translate_x10â–º
    â—„translate_y10â–º
    â—„center_x0â–º
    â—„center_y0â–º
    â—„path_selectorâ–º

    SVG paths are just text, and text can be transformed. SVG Path Manipulation does geometry operations directly on your path data - scale, rotate, translate, flip, simplify, even reverse - without ever rasterizing anything. It's the node for "that traced logo is sideways, flip it" and "this path has 4,000 points, make it 400."

    Operations

    • scale - multiply path coordinates by scale_x / scale_y (default 1.5). Keeps the shape, grows the geometry.
    • rotate - spin by rotation_degrees around center_x / center_y. Watch the center: rotating around 0,0 when your art lives at 200,200 will fling it off-canvas.
    • translate - shift by translate_x / translate_y.
    • flip_horizontal / flip_vertical - mirror around the center point you specify. The "my logo faces the wrong way" fix.
    • simplify - reduce point count in the path data. Uses the same Ramer-Douglas-Peucker family of ideas as Advanced SVG Compression, but scoped to path data.
    • reverse - reverse the direction of the path. Sounds niche, but it matters for correct fill-rule rendering on self-intersecting paths.

    path_selector lets you target specific paths by ID/class selector; leave it empty and it hits all of them. Output is a single STRING - the SVG with transformed path data.

    How it works

    It operates on the d attribute of path elements - parsing the coordinate commands, applying the transform to each point, and writing the data back. The mechanism is string-level path processing, which is fast and lossless (no rendering, no re-tracing), but it also means complex paths with lots of commands process point-by-point and transforms that involve curves can behave subtly differently than their raster counterparts.

    Install

    Pack standard:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MushroomFleet/svg-suite
    pip install -r requirements.txt
    

    Restart ComfyUI, or via Manager under "svg-suite". The pack's svg.path dependency is what powers path parsing here - if transforms come back unchanged, check that it installed.

    Where people get burned

    The center-point thing is the classic. scale and rotate both need a sane center, and the default 0,0 is almost never where your art is. Set center_x/center_y to the middle of your content (or use SVG ViewBox's center_content to fix the aftermath). If you forget, you'll get an SVG that's technically correct and visually gone - clipped to the corner.

    Second: transforms apply to path data, not to <g> group transforms. If your SVG wraps everything in a <g transform="...">, this node's operations won't multiply against that existing transform the way a real renderer would - they operate on raw coordinates. For converted SVGs from svg-suite's own pipeline (which writes actual path data), you're fine. For hand-authored files with transform nesting, results can look off.

    Category💎TOSVG/StringEdit

    Inputs (10)

    NameTypeDefaultDescription
    svg_stringSTRING—
    operationCOMBOscale7 options: scale, rotate, translate, flip_horizontal, flip_vertical, simplify, +1
    scale_xoptFLOAT1.50.1–10—
    scale_yoptFLOAT1.50.1–10—
    rotation_degreesoptFLOAT45-360–360—
    translate_xoptINT10-1000–1000—
    translate_yoptINT10-1000–1000—
    center_xoptINT0-1000–1000—
    center_yoptINT0-1000–1000—
    path_selectoroptSTRINGLeave empty for all paths or provide ID/class selector

    Outputs (1)

    NameTypeDescription
    STRINGSTRING—