Nodes/kubakub nodes/kubakub crop
ComfyUI Node

kubakub crop

Crop by drawing on the picture, as in Photoshop: drag a box, drag inside it to move it, the handles to size it (Shift keeps the ratio, Alt sizes from the centre), double click = all of it. Pick a ratio on the pills (original, 'picture' = the ratio of a connected picture, e.g. the facade matrix), and the size that comes out. Drag past the edge to add canvas: the new area is filled (edge, mirror, black, white, grey) and comes out as its own mask, for an outpaint. A batch or video is cut the same on every frame. The box is kept as a part of the picture, so it stays right when the picture comes at another size.

By kubakubkub·Created about a month ago·Updated 2 days ago· 10
kubakub crop
  • image
  • ratio_of
  • image
  • box_mask
  • new_area
  • crop_box
◄box0 0 1 1►
◄ratiofree►
◄sizeas cut►
◄model_safetrue►
◄filledge►
Categorykubakub/utils

Inputs (7)

NameTypeDefaultDescription
imageIMAGEThe picture (or the frames of a video) to crop.
boxSTRING0 0 1 1The box, drawn on the picture (kept as 0-1 of it). You never need to type it.
ratioCOMBOfreeThe box's shape (the pills on the picture).
sizeCOMBOas cutWhat comes out: the pixels as cut, or scaled to this long side.
model_safeBOOLEANtrueWidth and height in steps of 16 px (what Flux and most models want).
fillCOMBOedgeWhat fills the canvas added past the picture's edge.
ratio_ofoptIMAGEA picture whose shape the box takes (the 'picture' pill), e.g. the facade matrix.

Outputs (4)

NameTypeDescription
imageIMAGEThe crop (every frame).
box_maskMASKWhite where the box lies on the picture (the picture's size).
new_areaMASKWhite on the canvas added past the picture's edge (the crop's size): the mask for an outpaint. All black when nothing was added.
crop_boxKUBA_CROP_BOXWhere the crop came from: for kubakub uncrop.