Nodes/comfyui-AGSoft/🖼️✂️AGSoft Image Crop Plus
ComfyUI Node

🖼️✂️AGSoft Image Crop Plus

Actually draw your crop box in the ComfyUI graph

By Art-xmaster·Created 12 months ago·Updated about 9 hours ago· 23
🖼️✂️AGSoft Image Crop Plus
  • input_image
  • mask
  • crop_data
  • cropped_image
  • cropped_mask
  • width
  • height
  • filename
  • filepath
custom_path
image_name
crop_modePreset Ratio
aspect_ratio1:1
manual_width512
manual_height512
crop_coords[]
multiple8
pause_for_croptrue

The stock ComfyUI crop nodes are number-fiddlers: you type x, y, width, height and hope you got the composition right. This one lets you click. AGSoft Image Crop Plus puts an interactive cropping overlay right on the node - pick your image, draw the box with your mouse, and it crops exactly what you meant, then rounds the result to a sampler-safe size automatically.

That last part is the real reason to reach for it. Every model has a size it's happy with, and feeding it a 515x300 crop is how you get dimension errors or a sad latent. The node's multiple parameter snaps your crop to the model's multiple of choice - 8 for general SD/SDXL, 32 for LTX Video, 64 for FLUX and other strict models.

How it works

There's a little JavaScript that runs in the ComfyUI frontend (web/js/AGSoft_Image_Crop_Plus.js), which is why this node feels different from the rest of the pack: the cropping happens in the browser, on a canvas overlay, before the backend ever sees it.

You pick the image from the node's image_name dropdown - it lists whatever's in your ComfyUI input folder, and there's an upload button right in the node. Then choose how you want to crop:

  • Points (4 clicks) - click four corners of your crop. The freedom to trace something that isn't a straight rectangle-perfect region; the node will use the bounding box.
  • Preset Ratio - a resizable box locked to an aspect ratio like 1:1 or 16:9. Great for "crop this photo to a square without guessing."
  • Manual Size - a box with exact pixel dimensions, sized via manual_width / manual_height.

The coordinates you draw get stored into the crop_coords field as a JSON string. Do not hand-edit that field. It's clearly marked "automatically filled by the UI" and the entire point is that you never touch it. Leave image_name empty and the node passes the original image through untouched - a handy built-in bypass.

Inputs that matter

  • image_name - which file from the input folder to crop (or upload a new one).
  • crop_mode - Points / Preset Ratio / Manual Size.
  • aspect_ratio - only used in Preset Ratio mode.
  • multiple - the alignment value (8/32/64 per the model you're feeding). A 515x300 crop with multiple=8 becomes 512x296.

Outputs: cropped_image (IMAGE), plus width and height (INT) so you can wire the actual size into an Empty Latent.

Installation

From the comfyui-AGSoft pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Art-xmaster/comfyui-AGSoft.git
# restart ComfyUI

Or search "comfyui-AGSoft" in ComfyUI Manager. Because it uses custom frontend JS, make sure you fully restart the browser tab after installing - a live-reloaded UI sometimes misses the new widget until a refresh.

Where people get burned

Three things, mostly. Hand-editing crop_coords and breaking the JSON. Feeding a crop with a mismatched multiple into a model that's strict about it. And forgetting the crop is a crop - the output is whatever box you drew, so if you wanted an upscale-inpaint pipeline, remember this node is the "cut" half and you'll still need to resize or inpaint the result before it's sampler-ready. For the full inpainting loop, the pack's AGSoft Inpaint Crop / Stitch pair is the structured version of this idea.

CategoryAGSoft/Image

Inputs (11)

NameTypeDefaultDescription
custom_pathSTRINGOptional absolute path to an image. Priority: input_image > custom_path > image_name. Preview loads right after the path is entered (no Queue needed). --- Опциональный абсолютный путь. Приоритет: input_image > custom_path > image_name. Превью подхватывается сразу после ввода пути (без Queue).
image_nameCOMBOSelect an image from the input folder, or upload via the node button. --- Выберите изображение из папки input или загрузите кнопкой.
crop_modeCOMBOPreset RatioCropping method. --- Метод обрезки.
aspect_ratioCOMBO1:1Target aspect ratio (Preset Ratio mode). --- Целевые пропорции (Preset Ratio).
manual_widthINT51264–4096Crop width (Manual Size). --- Ширина обрезки (Manual Size).
manual_heightINT51264–4096Crop height (Manual Size). --- Высота обрезки (Manual Size).
crop_coordsSTRING[]AUTO-FILLED by the UI. Do not edit. --- ЗАПОЛНЯЕТСЯ интерфейсом. Не редактировать.
multipleINT81–128Align output to a multiple (8/32/64). --- Выравнивание выхода по кратности (8/32/64).
pause_for_cropBOOLEANtruePause execution when a tensor is connected: adjust the crop in the node and press ▶️ Resume (auto-resume after 300 s, ✕ cancels). --- Пауза выполнения при подключённом тензоре: настройте кроп и нажмите ▶️ Продолжить (авто-продолжение через 300 с, ✕ отменяет).
input_imageoptIMAGEOptional image tensor (priority). With pause_for_crop the execution waits for your crop and ▶️ Resume. --- Опциональный тензор (приоритет). При pause_for_crop выполнение ждёт ваш кроп и кнопку ▶️ Продолжить.
maskoptMASKOptional mask, cropped synchronously. --- Опциональная маска, обрезается синхронно.

Outputs (7)

NameTypeDescription
crop_dataCROP_DATA
cropped_imageIMAGE
cropped_maskMASK
widthINT
heightINT
filenameSTRING
filepathSTRING