Lineart (Soze):
Lineart turns an image into a line drawing by finding places where brightness changes sharply, such as the edges of a face, clothing, or an object. It uses Sobel edge detection, with optional smoothing and line-shaping steps to reduce texture noise, adjust line weight, and produce either soft grayscale lines or a stark black-and-white result. It works on a single image or a batch of images. This makes it useful when you want an edge-focused guide for an image workflow or a sketch-like preview, without relying on a learned line-detection model.
Lineart (Soze) Input Parameters:
image
The source image to turn into line art. Connect an IMAGE containing one or more frames; the node processes each frame separately and keeps their order. It uses the image’s red, green, and blue channels to estimate brightness, so differences in brightness drive the detected lines. If the image has an alpha channel, that channel is ignored. There is no default, minimum, or maximum value specified for this required input.
pre_blur_sigma
Controls how much the image is smoothed before edges are detected. A small amount of blur can keep fine texture, grain, or compression noise from becoming unwanted lines; increasing it may also soften small details you wanted to retain. Set it to 0 to skip this smoothing. The default is 0.5; the minimum is 0.0 and the maximum is 10.0, in steps of 0.05.
line_strength
Multiplies the detected edge strength before normalization and thresholding. Higher values can make edges more prominent, particularly when you use normalize set to none or apply a threshold; lower values make them weaker. Because this adjustment happens before normalization, its visible effect can be reduced when normalization rescales the lines. The default is 1.0; the minimum is 0.1 and the maximum is 10.0, in steps of 0.1.
normalize
Chooses how detected edge strengths are mapped into the output brightness range. The options are percentile_95 (default), max, and none. percentile_95 uses a level that is less dominated by a few unusually strong edges, making it a useful starting point for varied images. max scales relative to the strongest detected edge, while none leaves the edge strengths without that normalization step; the result is still limited to the valid output range. This choice affects how much contrast you see between faint and strong lines.
gamma
Adjusts the brightness of the detected lines after the soft threshold is applied. Values above 1.0 brighten weaker surviving lines and can make more of them visible; values below 1.0 darken them. It changes line intensity rather than choosing which edges the initial detection finds. The default is 1.0; the minimum is 0.1 and the maximum is 5.0, in steps of 0.05.
soft_threshold
Removes faint detected lines before gamma and line-shaping steps. Any edge strength below the chosen value becomes zero, while values at or above it are kept, so the remaining lines can still have different shades of gray. Use a modest value to suppress background texture without forcing the entire image to pure black and white. The default is 0.0 (off); the minimum is 0.0 and the maximum is 1.0, in steps of 0.01.
thickness
Expands the detected lines through repeated dilation, making them appear heavier. This happens after optional thinning, so you can first reduce the lines and then build them back up to a preferred weight. Higher settings may cause nearby lines to merge or obscure fine details. The default is 0 (no expansion); the minimum is 0 and the maximum is 10, in steps of 1.
thinning
Applies one erosion pass to reduce lines before any requested thickening. Turn it on when the initial edge map looks too broad or crowded, but check the result closely because faint or very fine features may disappear. The options are false (default) and true.
binarize
Switches from variable-brightness lines to a hard two-tone result. When enabled, each processed value becomes either zero or one according to binarize_threshold; when disabled, softer grayscale lines remain possible. This is useful when you need crisp marks rather than gradual edge shading. The options are false (default) and true.
binarize_threshold
Sets the cutoff used only when binarize is true. Processed values at or above the cutoff become white, and values below it become black, before any optional inversion. Raise it to retain only stronger lines; lower it to include more faint detail. It has no effect while binarize is false. The default is 0.5; the minimum is 0.0 and the maximum is 1.0, in steps of 0.01.
invert
Flips the final light and dark values. With false (default), the result has white lines on black, matching the convention identified in the node source for ControlNet lineart preprocessing. With true, it has black lines on white, which is often easier to view as a sketch. Inversion also applies to the mask output. The options are false and true.
Lineart (Soze) Output Parameters:
image
An IMAGE containing the finished line art for each input frame, in the same batch order and at the same width and height. Each frame has three identical color channels, so it appears grayscale: by default, stronger detected lines appear brighter against black; with invert enabled, they appear darker against white. The appearance also reflects any smoothing, thresholds, gamma adjustment, thinning, thickening, or binarization you selected. If the input is absent or empty, the node instead returns a blank 64 × 64 image.
mask
A MASK containing the same processed values as the image output’s first color channel for every frame. It provides the line-art result as a single-channel value map for connections that accept masks. By default, brighter mask values correspond to brighter detected lines; enabling invert reverses those values, so consider the polarity expected by the next node. If the input is absent or empty, the node returns a blank 64 × 64 mask.
status
A STRING reporting what happened. A successful result begins with OK: and includes the frame count, dimensions, selected blur, strength, normalization, and gamma settings, followed by applicable details such as thinning, thickening, binarization, and output polarity. For a missing or empty input, it reads Skipped: image is None or empty. Use it to confirm that the node ran and to check which settings produced a result; it is not a measure of image quality.
Lineart (Soze) Usage Tips:
- Start with the defaults for thin white lines on black. Turn on
invertwhen you want to inspect the result as black marks on a white sketch page; check the desired polarity again before connecting the result to another node. - If a photograph produces too many lines from skin texture, fabric, or grain, increase
pre_blur_sigmagradually. If unwanted faint lines remain, raisesoft_thresholda little at a time, checking that important contours stay visible. - For a softer edge guide, leave
binarizeoff and adjustgammato control the visibility of weaker lines. For a stark two-tone drawing, turnbinarizeon and tunebinarize_threshold: a higher cutoff keeps fewer, stronger marks. - If outlines look too wide, try
thinning. If they look too light or narrow, increasethicknessone step at a time; larger values can join neighboring contours. - Keep
normalizeatpercentile_95as a starting point when a few very strong edges overshadow the rest. Trymaxto scale against the strongest edge, ornonewhen you want to assess the less-rescaled edge strengths and the effect ofline_strength. - Check both
imageandmaskafter changinginvert. They carry the same line-art values, so a mask-consuming node may interpret the flipped background differently from what you intended.
Lineart (Soze) Common Errors and Solutions:
Skipped: image is None or empty.
- Explanation: This is the node’s explicit skip message. No input image was supplied, or the supplied batch contains no frames. The returned image and mask are blank placeholders, not processed line art.
- Solution: Connect an image-producing node to
imageand confirm that it supplies at least one frame.
OK: ... but the result is mostly black
- Explanation:
OK:means processing completed, but the chosen settings may have removed or darkened most visible lines. A highsoft_thresholdor, when binarizing, a highbinarize_thresholdcan discard weaker edges; gamma below1.0can darken surviving lines. The default black background can also make faint results hard to inspect. - Solution: Lower the relevant threshold, return
gammatoward1.0, and tryinvertfor a white-background preview. Adjust one setting at a time so you can see which change helps.
OK: ... but the result is mostly white
- Explanation: With
invertenabled, white is the background, so a mostly white image may simply contain few visible dark lines. Without inversion, a very low binarization cutoff or heavy line expansion can make much more of the image white. - Solution: Check
invertfirst. If you want more dark lines on a white background, reduce filtering or lowerbinarize_threshold; if white lines are spreading together on a black background, reducethicknessor raise the binarization cutoff.
OK: ... but fine details are missing
- Explanation: Strong pre-blur, thinning, a high soft threshold, or a high binarization cutoff can remove small or weak contours even when the node runs successfully.
- Solution: Reduce
pre_blur_sigma, switch offthinning, or lower the applicable threshold. If you need subtle detail rather than hard outlines, switch offbinarize.
OK: ... but there are too many noisy lines
- Explanation: Fine texture and grain also create brightness changes, so Sobel detection can treat them as edges. Brightening weak lines with
gammaabove1.0or using a low threshold can make that texture more noticeable. - Solution: Increase
pre_blur_sigmagradually, add a modestsoft_threshold, or bringgammacloser to1.0. Check that the main contours remain visible after each adjustment.
OK: ... but nearby lines have merged
- Explanation: A high
thicknesssetting expands lines until adjacent marks touch. A low binarization cutoff may also preserve extra marks between them. - Solution: Lower
thicknessfirst. Ifbinarizeis on, try raisingbinarize_thresholdslightly;thinningmay also help reduce the lines before expansion.
OK: ... but changing binarize_threshold does nothing
- Explanation:
binarize_thresholdis used only whenbinarizeistrue. - Solution: Enable
binarizeto use that cutoff. If you want to keep grayscale lines, leave it off and adjustsoft_thresholdinstead.
Shape or channel error while processing an image
- Explanation: The processing code expects a batch of images with height, width, and three color channels, or four channels whose alpha channel it can discard. An incompatible tensor shape may fail before a status message is returned; the exact exception text depends on the supplied data.
- Solution: Feed the node a standard ComfyUI
IMAGEconnection rather than an unconverted mask or other tensor, and check the preceding node if the image was assembled or reshaped manually.
