🖼️✂️AGSoft Image Crop Plus
Actually draw your crop box in the ComfyUI graph
- input_image
- mask
- crop_data
- cropped_image
- cropped_mask
- width
- height
- filename
- filepath
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 withmultiple=8becomes 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.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| custom_path | STRING | Optional 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_name | COMBO | Select an image from the input folder, or upload via the node button. --- Выберите изображение из папки input или загрузите кнопкой. | |
| crop_mode | COMBO | Preset Ratio | Cropping method. --- Метод обрезки. |
| aspect_ratio | COMBO | 1:1 | Target aspect ratio (Preset Ratio mode). --- Целевые пропорции (Preset Ratio). |
| manual_width | INT | 51264–4096 | Crop width (Manual Size). --- Ширина обрезки (Manual Size). |
| manual_height | INT | 51264–4096 | Crop height (Manual Size). --- Высота обрезки (Manual Size). |
| crop_coords | STRING | [] | AUTO-FILLED by the UI. Do not edit. --- ЗАПОЛНЯЕТСЯ интерфейсом. Не редактировать. |
| multiple | INT | 81–128 | Align output to a multiple (8/32/64). --- Выравнивание выхода по кратности (8/32/64). |
| pause_for_crop | BOOLEAN | true | Pause execution when a tensor is connected: adjust the crop in the node and press ▶️ Resume (auto-resume after 300 s, ✕ cancels). --- Пауза выполнения при подключённом тензоре: настройте кроп и нажмите ▶️ Продолжить (авто-продолжение через 300 с, ✕ отменяет). |
| input_imageopt | IMAGE | Optional image tensor (priority). With pause_for_crop the execution waits for your crop and ▶️ Resume. --- Опциональный тензор (приоритет). При pause_for_crop выполнение ждёт ваш кроп и кнопку ▶️ Продолжить. | |
| maskopt | MASK | Optional mask, cropped synchronously. --- Опциональная маска, обрезается синхронно. |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| crop_data | CROP_DATA | — |
| cropped_image | IMAGE | — |
| cropped_mask | MASK | — |
| width | INT | — |
| height | INT | — |
| filename | STRING | — |
| filepath | STRING | — |