Nodes/comfyui_dygen/DY Random Lines
ComfyUI Node

DY Random Lines

Scribble all over your image, one alpha-composited overlay at a time

By dymokomi·Created 2 years ago·Updated 2 years ago· 1
DY Random Lines
  • image
  • IMAGE
num_lines10
avg_thickness2.0
thickness_deviation1.0
avg_length100
length_deviation50
red255
green255
blue255
alpha255
color_deviation20
alpha_deviation20

DY Random Lines is the pack's doodle node: it throws a bunch of random straight lines across your image on a transparent overlay, then composites them back onto the original. It's a one-node way to get that scratched, sketchy, "someone drew on the photo" look, and if that's the aesthetic you're after, it does exactly one thing and does it fine.

Here's the pitch: your generated image looks too clean. You want texture - scribble marks, pencil-like strokes, an almost-painterly agitation across the surface. This node gives you a base color, a thickness, a length, and a count, then randomly scatters lines with jitter around each. Because every line is drawn on its own transparent overlay layer and alpha-composited, thin lines at low alpha read like pencil strokes rather than hard ink, and you can stack runs of the node to build up density.

How it works

The source is straightforward: pick a random start point, a random angle (0–2π), a random length around your average, draw a line of random thickness in a color that's your base RGB jittered by color_deviation, at an alpha jittered by alpha_deviation, then composite the whole overlay onto the image and convert back to RGB. Ten inputs, all of them knobs you'll actually feel:

  • num_lines (1–1000) - density. 10 is subtle; 500 is a blizzard.
  • avg_thickness / thickness_deviation - stroke weight and how much it varies.
  • avg_length / length_deviation - line length and variance. Long lines feel scribbly, short ones feel noisy.
  • red / green / blue (0–255 each) - the base line color. Default 255/255/255 is white.
  • color_deviation - how far each line wanders from that base color.
  • alpha / alpha_deviation - opacity and variance; lower alpha keeps lines subtle.

The trap to know about

There is no seed input. Every run is freshly random, so you cannot reproduce a result - rerun the queue and the scribbles move. If you need deterministic output, you'll have to route a seed into it yourself (or accept the dice). It also only processes the first image of a batch, and the base color is fixed white-by-default - if you want lines that pick up the colors underneath them, that's the pack's AdaptiveColorLines node instead, which samples the image at each line's midpoint.

Install

Part of dymokomi/comfyui_dygen by Dy Mokomi. ComfyUI Manager → search "comfyui_dygen", or:

cd ComfyUI/custom_nodes
git clone https://github.com/dymokomi/comfyui_dygen

Restart. No extra deps, no models - pure Pillow drawing.

Bottom line

It's a small, honest effect node with a niche job. Random lines over a portrait can look like a stylized editorial sketch; over a landscape they can read as noise, fast. Start with low counts and low alpha, and treat the missing seed as the feature you'll most want to fix.

CategoryDyGen/effects

Inputs (12)

NameTypeDefaultDescription
imageIMAGE
num_linesINT101–1000
avg_thicknessFLOAT2.00.1–100
thickness_deviationFLOAT1.00–50
avg_lengthINT1001–2000
length_deviationINT500–1000
redINT2550–255
greenINT2550–255
blueINT2550–255
alphaINT2550–255
color_deviationINT200–255
alpha_deviationINT200–255

Outputs (1)

NameTypeDescription
IMAGEIMAGE