Nodes/Jovimetrix/CROP (JOV) ✂️
ComfyUI Node

CROP (JOV) ✂️

Four-corner cropping with a color fill that saves your aspect ratio

By Amorano·Created 3 years ago·Updated 12 months ago· 397
CROP (JOV) ✂️
  • 👾
  • TL-TR
  • BL-BR
  • 🌈
  • 🖼️
  • 😷
🔳0.00

CROP (JOV) ✂️ is the pack's "robust cropping with color fill" node - and the color fill is the part that makes it interesting. Most crop nodes slice an image down to a rectangle and that's that. This one lets you define a crop by its four corners and fill the result with a color, which means you can extract a region, pad it, or reshape an image without losing the parts you cropped away. If you've ever needed to cut a face region out of a shot and then composite it onto a colored background, this is the node.

The inputs that matter

  • 👾 - the image to crop.
  • TL-TR (VEC4, default (0, 0, 1, 0)) - the top-left / top-right corner positions, normalized 0–1. This is a single 4-value vector: (top-left X, top-left Y, top-right X, top-right Y). In practice you'll set the X/Y of the crop's top edge here.
  • BL-BR (VEC4, default (0, 1, 1, 1)) - the bottom-left / bottom-right corners, same normalized convention. Together with TL-TR this defines a four-corner polygon - which means you can do non-rectangular crops, since the corners don't have to form a perfect box.
  • 🌈 (VEC3, default (0, 0, 0), 0–255) - the color used to fill areas outside the crop. Black by default; set it to match a target background.
  • 🔳 (FLOAT, 0–1, default 0) - the amount that blends the fill color into the result, so you can ease into a colored background instead of a hard edge.

Outputs are the cropped image and its mask, both as lists - the mask is what you'd wire into a compositor to place the crop back into the original frame.

How it works

The corners are normalized (0–1) so they scale with the input automatically - no pixel math on your part. The node extracts the polygon those four corners define, and any area the crop doesn't cover gets filled with the 🌈 color. That fill is the clever part: instead of returning a smaller image, you get a same-shape result with the background you chose, which plays nicely with the pack's compositing nodes. Pure OpenCV geometry, no model, instant.

Installing it

Part of Jovimetrix:

  • ComfyUI Manager - search "Jovimetrix", install.
  • Manual - git clone https://github.com/Amorano/Jovimetrix.git into custom_nodes/, then pip install -r requirements.txt.

No models. Dependencies: numpy, OpenCV (opencv-contrib-python), Pillow, matplotlib, cozy_comfyui. Needs ComfyUI 0.1.3+.

Where people get burned

The normalized corners are the classic trap: people type pixel values (like 100, 200) and get a crop that's 100/256ths of the image or just garbage, because the inputs are 0–1 fractions. Remember it's all relative - 0 is the left/top edge, 1 is the right/bottom. Second, the two VEC4s together define a quad, and if you swap their Y values you'll get a mirrored or inverted crop; keep TL's Y below BL's Y. If your goal is a simple center crop at an exact pixel size, the current CROP also has a center mode in newer builds - but the four-corner form here is the flexible one, and it's worth knowing because it's the one that can rescue an awkward aspect ratio without throwing pixels away.

CategoryJOVIMETRIX 🔺🟩🔵/COMPOSE

Inputs (5)

NameTypeDefaultDescription
👾opt*
TL-TRoptVEC40,0,1,00–1
BL-BRoptVEC40,1,1,10–1
🌈optVEC30,0,00–255
🔳optFLOAT0.000–1

Outputs (2)

NameTypeDescription
🖼️IMAGE
😷MASK