Nodes/ComfyUI Easy Use/ImageInsetCrop
ComfyUI Node Runs on cloud

ImageInsetCrop

Trim a fixed amount off each edge of an image

By yolain·Created 3 years ago·Updated 8 days ago· 2,633
ImageInsetCrop
  • image
  • IMAGE
measurement
left0
right0
top0
bottom0

Not every crop is "give me this rectangular region." Sometimes you just want to shave a strip off one or more edges - trim a watermark strip off the bottom, cut a black letterbox bar off the top and bottom, or knock a few pixels of border noise off all four sides before you feed the image into something that's picky about clean edges. That's an inset crop: instead of specifying where the crop region is, you specify how much to cut inward from each edge.

The node itself is Easy-Use's port of rgthree-comfy's ImageInsetCrop, credited as such in the pack's README - it's a small, useful utility rgthree built and Easy-Use folded in so you don't need a second pack installed just for it.

How it works

You pick a measurement mode - Pixels or Percentage - then set how much to remove from left, right, top, and bottom independently. In pixel mode, left: 100 chops exactly 100 pixels off the left edge. In percentage mode, the same field is read as a fraction of that dimension, so you get a crop that scales with image size instead of one that's a fixed pixel count regardless of resolution - useful if the same graph runs on images of different sizes and you want a proportional trim rather than an absolute one.

The inputs and outputs that matter

  • image - the image to crop.
  • measurement - Pixels or Percentage. Sets how the four edge values below are interpreted.
  • left, right, top, bottom - how much to remove from each edge, default 0, in steps of 8 (that step size lines up with the 8-pixel alignment most diffusion models expect for their internal resolutions, so cropping in multiples of 8 keeps you out of trouble downstream).

Leave any of the four at 0 to skip trimming that edge. The output is a single IMAGE - the cropped result, ready to wire into whatever's next (a resize node, a sampler's image-to-latent step, a save).

Installing it

You get this node with the base pack - no separate install needed for it specifically. ComfyUI Manager: search ComfyUI Easy Use, install, restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/yolain/ComfyUI-Easy-Use

then install.bat (Windows) or pip install -r requirements.txt, and restart. No models involved - it's pure tensor slicing.

Common issues & troubleshooting

Cropping more than the image has. If left + right exceeds the image's width (or top + bottom exceeds its height), you're asking for a crop that leaves nothing - that'll error or hand you a zero-size image depending on how extreme the values are. Sanity-check your numbers against the actual image dimensions before you commit, especially if you're driving the edge values from an upstream computation rather than typing them by hand.

Percentage mode surprises you on a resized batch. If images earlier in the graph get resized to different dimensions on different runs, a percentage-based inset crop will remove a different pixel count each time by design - that's the whole point of the mode. If you actually want a fixed pixel trim regardless of input size, switch back to Pixels.

Off-by-a-few-pixels after a resize step. If you're feeding a cropped image into a sampler and it complains about dimensions, remember the step size is 8 for a reason - keep your crop amounts as multiples of 8 (the widget already enforces this) so the result stays aligned with what your model expects.

CategoryEasyUse/Image

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
measurementCOMBO2 options: Pixels, Percentage
leftINT00–16384
rightINT00–16384
topINT00–16384
bottomINT00–16384

Outputs (1)

NameTypeDescription
IMAGEIMAGE