Load Image + Source Info
The loader that actually reads your EXIF and ICC
- image
- source_info
What it's for
Stock LoadImage does one thing and does it fine: pick a file, get a tensor. What it doesn't do is care that your phone wrote the photo sideways, or that your scanner embedded a colour profile, or that the filename and destination folder need to reach the saver at the other end of the graph.
This loader is the pack's "real photographs" entry point, and it's the difference between a batch of 200 scans arriving correctly oriented and coloured, and a batch of 200 you get to fix by hand. It loads pixels only - no cropping, no straightening, no resizing, no border removal, no levels. Border cleanup is Intelligent AutoCrop's job, one node later.
The controls
Required inputs, in the order you'll meet them:
mode-Singleloads the selected/uploaded image;Batchloads one photo from a folder per queued execution. Read that carefully: batch here means one at a time across queue runs, not a multi-image tensor batch. If you want a tensor batch, this isn't the node.input_dir- required in Batch mode. Relative toComfyUI/input, or absolute, or a~path.output_dir- carried untouched in the source info for the saver; blank leaves destination selection to the saver. Loading never writes anything or creates folders.pattern- a glob, blank meaning*.**/*.pngincludes subfolders. Eligible extensions are PNG, JPEG, WebP, TIFF and BMP, and sorting is natural, sophoto2precedesphoto10.strip_trailing_numbers- removes a trailing copy marker likephoto (2). It deliberately leaves normal digits alone;scan2024staysscan2024.repeat_last- holds the last successfully loaded photo instead of advancing. With no previous photo it loads the first one, and if files vanish it starts over from the first available.image- the upload/selection for Single mode. Ignored in Batch mode entirely, even if the selection is missing.
Then the two that earn the node its keep: color_management, defaulting to Convert to sRGB, which honours embedded 8-bit ICC profiles and assumes untagged RGB photos are already sRGB - Keep encoded values skips that conversion, which is useful when you're comparing against an older loader. And alpha_background (White or Black), which composites transparency. Note it composites rather than discarding: no alpha mask is emitted. If you need the alpha channel downstream, this isn't the loader.
Outputs are image and source_info (a PORTRAIT_SOURCE_INFO_V2 bundle). The second one is the quiet win: feed it to Save Info from Source and the saver gets the original filename stem and your output directory, so a processed batch lands with matching names instead of ComfyUI_00047_.png.
Reliability details that matter at batch scale
Each node instance keeps its own cursor. Two loaders pointed at the same folder don't advance each other. Up to 32 recent listings are retained, a failed decode never commits a new cursor position (fix or replace the file and retry - it isn't silently skipped), and adding files doesn't reset a cursor whose last file still exists.
The one that will confuse you: that state only lives as long as ComfyUI keeps the node object. Restart the server, clear the object cache, or recreate the node, and batch advancement starts again from the first file. No-cache mode doesn't retain node objects at all, so folder advancement needs normal caching. Single-mode images use a streamed content hash, so replacing a file with the same name, size and timestamp still invalidates the cache - content-based change detection, not a timestamp check.
Fidelity, and where it stops
EXIF orientation is applied before source dimensions are recorded, which is the correct order and the reason your portrait scans don't come out as 4000×3000 lying sideways. Output is CPU float32 RGB.
Standard 16-bit grayscale/RGB/RGBA PNG and TIFF decoding preserves 16-bit samples, with TIFF going through tifffile to sidestep orientation quirks in other decoders. Two honest limits: some compressed TIFFs need the optional imagecodecs package and the loader tells you so with install guidance rather than losing precision quietly; and embedded ICC conversion is refused for 16-bit files, because Pillow's ICC path works at 8-bit. Export a 16-bit sRGB copy with no profile, or deliberately choose Keep encoded values. 32-bit/HDR files fail with export guidance instead of being clipped, and animated or multipage inputs load their first frame.
Bring your own border removal: this loader won't strip an Alamy frame, and it'll happily hand that frame to your segmenter as part of the subject.
Install
ComfyUI Manager → search PortraitUtils (publisher heyburns, GPLv3), or:
cd ComfyUI/custom_nodes
git clone https://github.com/heyburns/PortraitUtils
/path/to/ComfyUI/venv/bin/python -m pip install -r PortraitUtils/requirements.txt
numpy, Pillow>=9.1, opencv-python-headless>=4.10.0.84 and tifffile into ComfyUI's Python environment - one OpenCV wheel variant only. imagecodecs is optional and only for exotic compressed TIFFs. Restart the ComfyUI server after installing.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | Single | 2 options: Single, Batch |
| input_dir | STRING | Batch folder; relative to ComfyUI/input or absolute. | |
| output_dir | STRING | Passed to Save Info from Source; blank keeps saver defaults. | |
| pattern | STRING | * | Batch glob; **/*.png includes subfolders. |
| strip_trailing_numbers | BOOLEAN | false | Strip only a trailing copy marker such as (2), not normal filename digits. |
| repeat_last | BOOLEAN | false | Batch: hold the last successfully loaded photo; first use loads the first file. |
| image | COMBO | 1 options: example.png | |
| color_management | COMBO | Convert to sRGB | Convert embedded 8-bit ICC profiles to sRGB. Untagged photos are assumed sRGB. |
| alpha_background | COMBO | White | Composite transparency onto this background; no alpha mask is emitted. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| source_info | PORTRAIT_SOURCE_INFO_V2 | — |