Yumil Image Loader
Load a reference image from a path string, sized the way your model wants
- image
- width
- height
ComfyUI's built-in Load Image reads from a dropdown of files in its input/ folder. That's fine when you pick a reference by hand and useless when the file path arrives as data - which is exactly what happens with this pack. Yumil Prompt Parser extracts embedded paths from prompts, Yumil Block Selector hands them out, and Yumil Image Loader is the thing that turns one of those path strings into a real IMAGE tensor the graph can use.
It also solves the second half of the reference-image problem: sizing. Reference images never come in the resolution your model wants, and this loader can resize them on the way in - including to a target it computes for you, so you don't have to know the exact pixels up front.
How it loads and resizes
Load a path, EXIF-transpose it (so phone photos aren't sideways), flatten any RGBA transparency onto a white background, convert to RGB, and hand back a (1, H, W, 3) float tensor. Nothing exotic - but the resize logic is where it earns its keep.
resize_mode-disabled(keep original size),stretch(squish to fit),crop_center(cover the target, cropping the overflow), orpad_white(fit inside with white bars).target_total- here's the clever bit: instead of asking for width and height, you give a sum.2048for SDXL, for instance. The node preserves aspect ratio and solves for dimensions that add up to that total, rounded to the nearest multiple of 8 (latent alignment). A 3:2 image at 2048 becomes 1224×824; a 1:1 becomes 1024×1024; a 9:16 becomes 736×1312. One number, correct size for whatever aspect ratio the source happens to be.0disables it.width/height- explicit overrides, and the priority is: explicit width/height >target_total> original. The tooltip gives the intended use: connect width/height from another Yumil Image Loader so every reference image lands at exactly the same size, which matters when a batch of references has to match.
One quirk to know: if you set an explicit width/height but leave resize_mode as disabled, it treats the resize as stretch - an explicit size beats the "don't resize" default. The output width and height INTs report the final dimensions, so you can read back what you actually got and feed it to a size-matching node.
Wiring and troubleshooting
Feed path from Yumil Block Selector's path_0 (or any STRING source), get image out into whatever wants an IMAGE - ControlNet preprocessor, IPAdapter, image-to-image latent, regional prompt blocks.
Two failure modes, both obvious when they happen:
- File not found - the node raises a clear
FileNotFoundErrornaming the path. If you're pulling paths from MPM prompts, this usually means the stored path is relative to a machine or folder that doesn't match your setup. Paths in the prompt markup are raw file paths, so they only work if the file lives where the path says it does. - Empty path - if nothing is wired or the string is blank, you get a "path is empty" error. Make sure the selector actually produced a path (blocks without
Path(...)yield empty strings).
It installs as part of the pack - ComfyUI Manager search comfyui-yumil-mpm, or:
cd ComfyUI/custom_nodes
git clone https://github.com/maigonia/comfyui-yumil-mpm.git
cd comfyui-yumil-mpm
pip install -r requirements.txt
then restart. requests is the only declared dependency; the loader itself uses Pillow and torch that ComfyUI already ships, so nothing heavy gets pulled in.
A last thought: because paths arrive as text, this loader is also handy outside the Yumil pipeline. Any node that emits a file path - a directory scanner, a filename builder, a FindFirst-style helper - can feed it. It's a string-path loader with nice resize math, which is a more broadly useful thing than the pack's branding suggests.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| path | STRING | Image file path. Connect from Block Selector path output. | |
| resize_mode | COMBO | disabled | How to resize. 'disabled' keeps original size. |
| target_total | INT | 00–8192 | Target width+height sum (e.g. 2048 for SDXL). 0 = no resize. Ignored when width/height are connected. |
| widthopt | INT | Override width. Connect from another Loader to match sizes. | |
| heightopt | INT | Override height. Connect from another Loader to match sizes. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| width | INT | — |
| height | INT | — |