Nodes/Shima/Shima Interactive Crop
ComfyUI Node

Shima Interactive Crop

Drag a box on the image, get a crop, a mask, and clean numbers

By KDB-USJP·Created 6 months ago·Updated 6 months ago· 2
Shima Interactive Crop
  • image
  • shima.commonparams
  • cropped_image
  • crop_mask
  • crop_data
image_path
crop_x0.000
crop_y0.000
crop_w1.000
crop_h1.000
aspect_ratio
orientationlandscape
activetrue

Region-based work - crop a face, fix a hand, feed one character into an IP-Adapter - always starts the same way: you need a rectangle, and you need its coordinates as numbers. Shima Interactive Crop is the friendly version of that. You drag a box over the image in the node, and out come three things at once: the cropped pixels, a mask marking exactly where that box was, and a dictionary of clean x/y/width/height data. No guessing, no measuring in a paint program.

How it works

The crop coordinates are normalized - crop_x, crop_y, crop_w, crop_h are all 0–1 fractions of the image, so the values stay stable if you swap in a different-sized source. The backend multiplies them by the actual pixel dimensions, slices the tensor, and builds a mask that's 1.0 inside the crop region and 0.0 everywhere else, padded back to full size. That mask is the gift here: it means you can tell downstream nodes where the crop came from, which is what makes stitch-back and region-paint workflows possible.

There's a frontend layer that makes this feel interactive - you draw the box on a preview, and the numbers update underneath. The aspect_ratio dropdown (Free, 1:1, 4:3, 16:9, 21:9, 3:2, plus an IP-Adapter 224×224 mode) constrains your box while you drag. Pick "IP-Adapter (224x224)" and the crop gets resized to exactly 224×224 with bicubic interpolation, which is what the IP-Adapter CLIP vision encoder expects - that's a genuinely thoughtful touch, because that mismatch is a classic silent failure.

The inputs that matter

  • image (optional) - if connected, it overrides the internal file loader. Connect your loaded image for a live workflow.
  • image_path - a dropdown of files in ComfyUI's input directory, used when no image is connected.
  • crop_x / crop_y / crop_w / crop_h - the normalized box. Usually you let the frontend fill these by dragging.
  • active - set to false and the node passes the full image through with a full-size mask. Nice for A/B toggling a crop on and off.

The three outputs - cropped_image, crop_mask, and crop_data (the DICT with pixel and normalized coords plus original dimensions) - cover the three ways you'll want to consume the selection.

Installing it

Part of the Shima pack. ComfyUI Manager → search Shima, or:

cd ComfyUI/custom_nodes
git clone https://github.com/KDB-USJP/shima_wf.git Shima

Restart ComfyUI; first launch auto-installs the pack's deps and companion repos (ComfyUI-Impact-Pack, cg-use-everywhere).

Common issues

  • "requires an 'image' input or a selected 'image_path'" - you gave it neither. Either wire an image or pick a file in the dropdown.
  • The dropdown is empty. There's nothing in ComfyUI's input/ folder. Drop a file there and refresh.
  • Crop coordinates feel wrong. Remember they're normalized. If you're hand-typing crop_w, 1.0 means "the whole image," not 100 pixels.
  • IP-Adapter results look off. If you're using this for IP-Adapter, use the dedicated 224×224 aspect preset rather than cropping loose and letting the adapter resize later - that exact-resolution path is the reliable one.

For ControlNet-style region work, pair the crop_mask with an inpaint or regional prompting node and the crop_data with anything that wants pixel coordinates. It's one of those nodes that quietly becomes a habit once you've used it once.

CategoryShima/ControlNet

Inputs (10)

NameTypeDefaultDescription
image_pathCOMBO1 options: example.png
crop_xFLOAT0.0000–1
crop_yFLOAT0.0000–1
crop_wFLOAT1.0000–1
crop_hFLOAT1.0000–1
aspect_ratioCOMBO8 options: Free, Custom, 1:1 Square, 4:3 Standard, 16:9 Widescreen, 21:9 Ultrawide, +2
orientationCOMBOlandscape3 options: landscape, portrait, auto
imageoptIMAGEIf connected, overrides the internal image_path loader.
shima.commonparamsoptDICTIf connected, frontend can read target width/height for custom ratio.
activeoptBOOLEANtrue

Outputs (3)

NameTypeDescription
cropped_imageIMAGE
crop_maskMASK
crop_dataDICT