Nodes/ComfyUI-Image-Segmenting-Loader/🎯 Qwen Segment Loader
ComfyUI Node

🎯 Qwen Segment Loader

Cut out any region by the numbers β€” with a live grid so you can actually aim it

By GeekyGhostΒ·Created about a year agoΒ·Updated about a year agoΒ· 1
🎯 Qwen Segment Loader
    • original_image
    • segment_image
    • segment_metadata
    • segment_width
    • segment_height
    • coordinate_preview
    β—„imageβ–Ύβ–Ί
    β—„segment_x0β–Ί
    β—„segment_y0β–Ί
    β—„segment_width512β–Ί
    β—„segment_height512β–Ί
    β—„target_size1024β–Ί
    β—„grid_spacing100β–Ί
    β—„show_coordinatestrueβ–Ί
    β—„enable_auto_previewtrueβ–Ί

    Qwen Segment Loader is the node you reach for when you want to crop one exact region out of an image, edit just that piece, and know precisely where it came from so you can put it back. It's a coordinate-driven image loader with a live grid overlay drawn on top of your picture, so instead of eyeballing a crop box you type X, Y, width and height numbers and watch the selection rectangle snap around while ComfyUI re-renders the preview.

    That naming deserves a quick note, because it's a trap if you don't know it's there: the "Qwen" is branding, not the model. This node does not call Qwen-Image-Edit, needs no API key, downloads no weights, and won't run a single token of the diffusion model. It's plain Pillow + torch + numpy image geometry. The "Qwen" label exists because the workflow this pack was built for is segmenting a big image into chunks that an editor like Qwen-Image-Edit can actually chew on - that model re-emits the whole frame, and on a 2KΓ—3K input it gets slow and loses detail, so the community-standard move is cutting the image into 1024Γ—1024-ish segments, editing each, and recomposing. This node is the "cut" half of that.

    Mechanically it's simple and honest. You upload an image, give it segment_x, segment_y, segment_width and segment_height, and it crops exactly that box - no padding, no rounding to something fancier. Coordinates get clamped to the image bounds silently, so a box that pokes past the edge just gets shortened rather than erroring. There's a target_size cap: if your crop is larger than it, the segment is downscaled with LANCZOS keeping aspect ratio. Importantly it only ever shrinks - set target_size to 1024 and a 512-wide crop stays 512.

    The clever bit is the preview. The node hashes all the preview-relevant parameters and tells ComfyUI to re-execute when any of them change, so with enable_auto_preview on, dragging segment_x from 0 to 400 instantly redraws the grid. The overlay itself is a white grid with gold coordinate numbers on the edges and a pink selection rectangle with corner markers - genuinely handy for aiming, since you otherwise have no way to know what pixel 1370, 210 means.

    The inputs that matter for a beginner: segment_x/segment_y (top-left of the crop), segment_width/segment_height (size of the crop), and grid_spacing for how dense the ruler lines are. The outputs are the important part. original_image passes your source through untouched. segment_image is the cropped region, ready to feed an editing node. segment_metadata is a JSON string recording the original size, the crop coordinates and sizes - the compositor in this pack needs it to put the segment back. coordinate_preview is the grid overlay; wire it to a Preview Image node and leave it on the canvas while you tune numbers. There are also segment_width/segment_height INT outputs if you want the dimensions elsewhere in your graph.

    Install is painless because the pack is genuinely light. In ComfyUI Manager search "ComfyUI-Image-Segmenting-Loader", or from the command line:

    cd ComfyUI/custom_nodes
    git clone https://github.com/GeekyGhost/ComfyUI-Image-Segmenting-Loader
    

    Restart ComfyUI. Dependencies are Pillow>=9.0.0, torch>=1.13.0, numpy>=1.20.0 - you almost certainly already have all three, so there's no model download and no multi-gigabyte surprise waiting.

    Two honest gotchas. First, one segment per generation: the loader processes a single crop box, so if you need six chunks for a big image you're running the workflow six times with different coordinates (or building six loader instances). People who've used it for Qwen-Image-Edit chunking note exactly this - it works, but you're doing each segment by hand. Second, there's no click-to-select on the preview; it's numbers only. grid_spacing and show_coordinates are your aiming aids. If you want SAM-style click segmentation, this isn't it - this is the precise, reproducible, "type the numbers" tool, which for compositing is honestly what you want anyway.

    Category🎯 Geeky Qwen Edit

    Inputs (9)

    NameTypeDefaultDescription
    imageCOMBO1 options:
    segment_xoptINT00–4096β€”
    segment_yoptINT00–4096β€”
    segment_widthoptINT51264–2048β€”
    segment_heightoptINT51264–2048β€”
    target_sizeoptINT1024256–2048β€”
    grid_spacingoptINT10025–200Spacing between grid lines in pixels
    show_coordinatesoptBOOLEANtrueβ€”
    enable_auto_previewoptBOOLEANtrueβ€”

    Outputs (6)

    NameTypeDescription
    original_imageIMAGEβ€”
    segment_imageIMAGEβ€”
    segment_metadataSTRINGβ€”
    segment_widthINTβ€”
    segment_heightINTβ€”
    coordinate_previewIMAGEβ€”