Torn Edge Lines / 破れ線ランダム生成
Two seeded torn-paper bands, as an image and a mask
- line_image
- line_mask
This one is a different animal from the rest of the pack: it doesn't touch a model, a prompt or a latent. It draws two torn-paper-style lines across a canvas and gives you both the picture and the mask, procedurally, in milliseconds.
What it's for
Two white bands on a black background sounds like nothing until you're building a layout that needs them: a torn divider between panels, a ragged strip mask for compositing one image over another, a decorative overlay, a boundary you want to noise up so it doesn't read as a straight line. This is a deterministic pixel operation, the category the KB calls post-processing - no diffusion pass, no seed lottery, and the result is the same every time for a given seed.
The mask output is the part worth understanding. Anywhere you'd draw a rectangle and then spend ten nodes roughening its edge, you can generate the roughed edge directly and composite through it.
How it works
Under the hood it builds each line as a 1D random curve and fills between its upper and lower boundary.
The center path is three octaves of smoothed noise - a large-amplitude coarse wave, a medium one, and a fine one - so you get paper-like direction changes rather than digital jitter. The band's thickness waves independently along its length, and the two edges jitter separately, which is what stops it looking like a sine wave. On top of that it sprinkles small white ellipses outward along the boundaries (the fraying fibers) and small black ellipses inward (the bites taken out of the edge). The result is drawn as a polygon into a mask, antialiased by rendering at 2x and downsampling with Lanczos, then thresholded into the mask tensor. The image output is that same mask replicated across three channels - white lines on black.
Two details you can feel in use. Top and bottom lines run on independent random streams derived from the seed, so changing bottom_thickness doesn't reshuffle the top line's shape. And supersampling drops from 2x to 1x above roughly 4.2 megapixels, to avoid eating RAM on huge canvases - at 4K-plus you'll see slightly harder edges.
Inputs and outputs
width (1536) and height (1024) are the output canvas. top_y_percent (27) and bottom_y_percent (77) place each line's center, as a percentage of height. top_thickness (34) and bottom_thickness (42) are in pixels. roughness (90) is the amplitude budget shared across those three octaves - at 0 you get clean straight bands, and the higher you push it the more violently the line wanders. Values above a few hundred start to look less like torn paper and more like a seismic reading. seed controls the shape and has the usual randomize control, so lock it when you find a composition you like.
Outputs are line_image (IMAGE) and line_mask (MASK). The mask is the one you'll usually wire: into a mask composite, a blur or grow, an inpainting region, or a mask-to-image path. The image goes into whatever image compositing or overlay node you're using, or straight into a preview if you're just dialing in the shape.
Note the defaults came from a specific 1536×1024 reference image, and they're tuned for it. Change the canvas and the y-percentages keep working, but the pixel thicknesses will look proportionally different.
Install
This node ships inside the same pack:
cd ComfyUI/custom_nodes
git clone https://github.com/nobinBB/comfyui-easy-use-anima
pip install piexif
Or ComfyUI Manager → comfyui-easy-use-anima, then restart. It needs nothing else - no Anima model, no piexif, no ComfyUI-Easy-Use, no additional libraries beyond the numpy/PIL/torch that ComfyUI already has. You can use it in an Illustrious or Flux workflow without any of the pack's Anima machinery.
Where people trip
The lines get clipped at the canvas edges rather than allowed to run off it, so pushing top_y_percent to 0 or bottom_y_percent to 100 flattens the band into a hard edge - which is occasionally what you want, but is usually a surprise.
Because both boundaries are clipped independently, a roughness bigger than the line's distance from the edge will produce a band that runs along the top and looks nothing like the torn edge you dialed in. Keep the placement away from the extremes.
And if you need a hard-edged mask for a node that dislikes soft mattes, threshold the mask yourself - the antialiased edges are great for blending and slightly wrong for binary regions.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 153664–8192 | — |
| height | INT | 102464–8192 | — |
| top_y_percent | FLOAT | 27.00–100 | — |
| bottom_y_percent | FLOAT | 77.00–100 | — |
| top_thickness | INT | 341–1024 | — |
| bottom_thickness | INT | 421–1024 | — |
| roughness | INT | 900–1024 | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| line_image | IMAGE | — |
| line_mask | MASK | — |