Nodes/ComfyUI-Purz/Image Crop Upload (Purz)
ComfyUI Node

Image Crop Upload (Purz)

The crop that survives a refresh

By purzbeats·Created about a year ago·Updated 3 months ago· 24
Image Crop Upload (Purz)
    • image
    imageexample.png
    width1024
    height1024
    fit_modecover
    anchorcenter
    background_color#000000
    zoom1.00
    offset_x0.00
    offset_y0.00

    The frustrating thing about most "visual crop" nodes is that your crop disappears when you close the browser. PurzImageCropUpload is the version that doesn't: the image is uploaded to ComfyUI's input/ directory the moment you pick it, and the workflow serializes the filename plus every crop parameter - so reload the page, and your crop is still sitting there exactly where you left it. It's the persistent sibling of the client-side Image Crop node, and for anyone doing serious workflow iteration it's the one you actually want.

    From ComfyUI-Purz's Purz/Interactive family, by PurzBeats (a Comfy Org staffer).

    How it works

    Unlike the client-side variant, the file goes to the server immediately and is processed there. The upload node exposes the crop controls as real, workflow-serializable inputs - image (the filename, picked from a dropdown of everything in input/), width, height, and the geometry settings - so saving your workflow saves your crop. Resizing happens server-side with Pillow (Image.LANCZOS), which is fast and deterministic.

    The fit modes are the same four as the client-side version:

    • stretch - squish the source to the output size, distorting as needed.
    • cover - scale to fill the output, cropping the overflow, positioned by anchor.
    • contain - scale to fit inside the output, letterboxing with background_color (default #000000).
    • crop - like cover, but adds zoom and offset_x/offset_y on top so you can punch in further.

    The inputs that matter

    • image - the filename from your input/ directory. This is the one input everyone sets; everything else is optional tweaking.
    • width / height - output size, 16 to 16384.
    • fit_mode - stretch, cover, contain, or crop. Default is cover, which is the right default for "fill the frame."
    • anchor - center, top, bottom, left, right, plus the four corners. Where the crop window sits within the source.
    • zoom - 0.1–10, only meaningful in crop mode. This is your "punch in" knob.
    • offset_x / offset_y - −1 to 1, fine positional nudges (in crop mode). These are what the draggable overlay of the client-side node updates for you.

    Output is image, type IMAGE, at exactly the size you asked for.

    Installing it

    ComfyUI Manager - search ComfyUI-Purz - or:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/purzbeats/ComfyUI-Purz.git
    cd ComfyUI-Purz
    pip install -r requirements.txt
    

    Restart ComfyUI. Requirements are OpenCV, Pillow, torch, numpy - all standard, no model downloads.

    Where people get burned

    Remember which mode you're in. zoom and offset_x/offset_y do nothing in stretch, cover, or contain - they only apply in crop mode, so people drag those sliders, see no change, and assume the node is broken. Also, since the file now lives in input/, it counts against your ComfyUI storage and gets picked up by any node that scans that directory - nothing to clean up, but worth knowing where your disk space went. And if you're on the client-side Image Crop for a quick one-off, the same UX is there - this node just adds persistence and a slightly less drag-friendly interface.

    CategoryPurz/Interactive

    Inputs (9)

    NameTypeDefaultDescription
    imageCOMBOexample.png1 options: example.png
    widthINT102416–16384
    heightINT102416–16384
    fit_modeCOMBOcover4 options: stretch, cover, contain, crop
    anchorCOMBOcenter9 options: center, top, bottom, left, right, top-left, +3
    background_colorSTRING#000000
    zoomFLOAT1.000.1–10
    offset_xFLOAT0.00-1–1
    offset_yFLOAT0.00-1–1

    Outputs (1)

    NameTypeDescription
    imageIMAGE