Nodes/comfyui_bmad_nodes/RemapFromInsideParabolas
ComfyUI Node Runs on cloud

RemapFromInsideParabolas

Unwrap a curved band back into a flat strip — the reverse of the parabola bend

By bmad4ever·Created 3 years ago·Updated 9 months ago· 70
RemapFromInsideParabolas
  • src_mask_with_2_parabolas
  • REMAP
width512
height512

RemapInsideParabolas bends a straight band to follow two curves. This node is the exact opposite: you hand it the two parabolas and it unwraps the curved region between them into a flat rectangle. Think of it as taking a photo of a curved label or sign, drawing along the two curved edges, and getting back the label as if it had been laid flat. If you've ever wanted to read text that's wrapped around a bottle or cylinder in a photo, this is the tool - it's the flat-lay that makes the text readable and the geometry measurable.

It's a REMAP generator in the pack's family: RemapFromInsideParabolas → Remap → image. Unlike its siblings, it produces a new size output, because unwrapping to a rectangle means the destination dimensions are up to you.

How it works

This is the heavy one. The simple direction (wrapping a straight band onto curves) is straightforward mapping; unwrapping means going the other way, and the math gets real. The source code computes arc-length integrals along the fitted parabolas and then, per destination pixel, solves the inverse - finding the point along the curve whose arc length corresponds to the destination's position. It's the same kind of per-pixel root-finding the reverse-barrel node uses, and the source shows the author reaching for joblib parallel execution again. The point is that the flat result is spaced by true arc length along the curve, so the unwrap doesn't distort distances - a straight 10cm on the label stays 10cm in the output.

The inputs

  • src_mask_with_2_parabolas (MASK) - the two curves bounding the region to unwrap, drawn on the source image.
  • width / height (16–4096, default 512) - the dimensions of the flat output rectangle.

Output: REMAP, at that width×height.

Where you'd reach for it

Reading curved text is the flagship use, but the deeper value is measurement: unwrap a curved region and suddenly distances, angles, and proportions in that band are Euclidean and comparable - useful for collage composition and geometry work. It's also the natural pair with the forward parabola nodes: wrap a texture onto a curved surface, render, then unwrap the result to check your work.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_bmad_nodes

restart, or search comfyui_bmad_nodes in ComfyUI Manager. OpenCV plus the pack's requirements (the parallel bits come with scikit-image's joblib). No model downloads.

The honest caveat

Two things make this node finicky. First, the quality of your drawn curves is the quality of the unwrap - same as the wrap direction, garbage in, garbage out. Second, it's slow: per-pixel root-finding at the output resolution, so a 2048×2048 unwrap will make you wait. And because the destination is a blank rectangle you define, regions the curves don't cover come out as transparent/empty areas you'll need to handle. Start at 512×512 to check the curves, then raise resolution once the fit looks right.

CategoryBmad/CV/Transform

Inputs (3)

NameTypeDefaultDescription
src_mask_with_2_parabolasMASK
widthINT51216–4096
heightINT51216–4096

Outputs (1)

NameTypeDescription
REMAPREMAP