Nodes/ComfyUI_Fill-Nodes/FL Padding Remover
ComfyUI Node

FL Padding Remover

Strip uniform borders off an image automatically

By filliptm·Created 3 years ago·Updated about 6 hours ago· 628
FL Padding Remover
  • image
  • IMAGE
tolerance30
min_content_size20
sides_trim1
top_bottom_trim1
debug_viewfalse
use_gpufalse

You've got images with letterboxing, solid-color borders, or padding baked in from an earlier resize step, and you want just the actual content cropped out - without knowing in advance exactly how many pixels of border there are, because it might differ per image. FL_PaddingRemover figures that out for you rather than requiring you to hand it fixed crop numbers. It's the inverse job of FL_Padding, which adds borders on purpose; this one detects and removes borders that are already there.

How it works

It analyzes edge colors row by row and column by column, looking for consistency - a genuine padding border reads as rows/columns of near-identical color near the image's edges, and the node walks inward from each side until the color stops being consistent, which is where the real content starts. tolerance controls how strict "consistent" means (higher tolerance treats more color variation as still-padding, so it'll trim more aggressively). min_content_size is a safety floor - it won't crop so aggressively that it leaves you with a sliver smaller than this, which matters because a very uniform, low-contrast image could otherwise get over-trimmed by an edge-detection approach like this. sides_trim and top_bottom_trim add a small additional manual trim on top of the detected crop, for cases where the auto-detection gets close but not quite exact.

The inputs and outputs that matter

  • tolerance (0–255, default 30) - the main knob. If real content is getting trimmed away, lower it; if visible padding is being left behind, raise it.
  • min_content_size (default 20) - the floor that stops runaway trimming on flat or low-contrast images.
  • sides_trim / top_bottom_trim - small manual nudges after the automatic detection, for fine-tuning the last few pixels.
  • use_gpu - offloads the edge analysis to GPU, worth enabling if you're batch-processing a lot of images and CPU is the bottleneck.
  • debug_view - when something looks wrong, turn this on before touching tolerance blind; it's the fastest way to see what the node actually detected as "padding" versus "content."
  • Output: IMAGE, cropped to the detected content bounds.

How to install it

Via ComfyUI Manager: search "ComfyUI_Fill-Nodes" and install. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes

then restart ComfyUI. Standard image-processing dependency footprint - nothing exotic for this node specifically. The pack overall is a large, general-purpose collection from filliptm, one prolific solo author, also covering PDF tools, GPT/Gemini/Fal API wrappers, and a full KSampler family; this node's needs are modest by comparison.

Common issues & troubleshooting

Real content gets cropped away. Almost always tolerance set too high on an image whose actual content has large flat-color areas near the edges (a plain sky, a solid backdrop) - the detector reads that as padding. Lower tolerance, or use debug_view to confirm what it's actually seeing before adjusting blind.

Padding doesn't fully go away. Either tolerance is too low to catch slightly-varying border color (compression artifacts near the edge can break perfect uniformity), or the leftover sliver is smaller than min_content_size and the node is refusing to crop further as a safety measure - check both before assuming it's a bug.

Batch results are inconsistent. Since detection runs per-image based on that image's own edge colors, a batch with genuinely different amounts of padding per image is expected to produce different crop amounts per image - that's the intended behavior, not a flaw. If you actually need identical crop dimensions across a batch, this isn't the right node; you'd want a fixed manual crop instead.

Category🏵️Fill Nodes/Image

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
toleranceINT300–255
min_content_sizeINT201–1000
sides_trimINT10–256
top_bottom_trimINT10–256
debug_viewBOOLEANfalse
use_gpuBOOLEANfalse

Outputs (1)

NameTypeDescription
IMAGEIMAGE