Reference Images Batch (old id)
LibraryImageBatch decides whether your reference images get black bars or get cropped
- image_1
- image_2
- image_3
- image_4
- image_5
- image_6
- image_7
- image_8
- image_9
- image_10
- image_11
- image_12
- image_13
- image_14
- image_15
- image_16
- image_17
- image_18
- image_19
- image_20
- image_21
- image_22
- image_23
- image_24
- image_25
- image_26
- image_27
- image_28
- image_29
- image_30
- image_31
- image_32
- image_33
- image_34
- image_35
- image_36
- image_37
- image_38
- image_39
- image_40
- image_41
- image_42
- image_43
- image_44
- image_45
- image_46
- image_47
- image_48
- image_49
- image_50
- image_51
- image_52
- image_53
- image_54
- image_55
- image_56
- image_57
- image_58
- image_59
- image_60
- image_61
- image_62
- image_63
- image_64
- images
LibraryImageBatch is the old id of the pack's Reference Images Batch (internal) node, and both of those words matter. "Old id" means it's the name used before the 0.1.2 rename - the class is just class LibraryImageBatch(ReferenceImagesBatch): pass. "Internal" means you were never supposed to add it from the node menu: the Reference Prompt drops it into the prompt for you when its images output feeds a model with a single images input, like Nano Banana Pro.
So why would you be reading this? Three reasons, and all three are about the same thing: this node is where your reference images get resized into one batch, and its mode setting is why you're getting black bars or cropped heads.
What it does
A batch has to be one size. That's not a ComfyUI quirk, it's what a tensor batch is. So when you send three references of different shapes to a model that takes a batch, something has to give, and this node decides what.
pad(the default) - every image is scaled to fit inside the first image's dimensions, then centred on a black canvas. Nothing is cut off. Your portrait reference sits in a landscape frame with bars down both sides.crop- every image is scaled to fill the first image's dimensions, centred, and the edges past the frame are cut. This is ComfyUI's Batch Images behaviour.stretch- scale to the target size and ignore aspect ratio entirely. Faces get taller or wider. Use it when the model re-renders everything anyway and you don't care.
The target size always comes from the first input image, so the order of your inputs is a real setting, not an accident. The pack's own documentation is blunt about the trade-off: pad never crops anything, and if you want to control the resizing yourself, skip the batch output and wire the Reference Prompt's individual @name outputs through your own resize/crop nodes.
Inputs and outputs
mode- required enum,pad/crop/stretch, defaultpad.image_1…image_64- optionalIMAGEinputs, up to 64 of them. Inputs fire in numeric order, and if an input carries a multi-frame batch, every frame goes in, in order. So this is really "up to 64 image slots, each of which may hold many frames".images- oneIMAGEoutput, the stacked batch.
Two details you can only get from the code: resizing uses Lanczos, and if the inputs have different channel counts the batch is trimmed to the smallest (c[:, :, :, :min_c]), which is how an RGBA reference ends up as RGB without anything complaining. Masks don't come along for the ride - a mask output isn't part of this node, so alpha is dropped at the batch stage. If you need the mask downstream, take it from the Reference Image node before batching.
Where you'll actually see it
You'll meet this node in two places, neither of them the search box:
- Exported API workflows. Queue a workflow where a Reference Prompt's
imagesoutput goes into a model's singleimagesinput, then hit Export (API). The prompt the server receives contains aReferenceImagesBatch(or, in an older export,LibraryImageBatch) with yourmodeand animage_Nper tagged file. That's the node that explains the padding. - Workflows saved before 0.1.2, which reference the old id. They load and run unchanged.
Could you add it deliberately? Only by copying the node out of a saved workflow or pasting its JSON into the graph, since it's hidden from the search box. Honestly, for hand-built batches ComfyUI's core Batch Images does the same job with a visible UI. This node exists to make the Reference Prompt's images output work, and that's the job it's good at.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/PixelMonkey77/comfyui-reference-library
Restart ComfyUI, or use ComfyUI Manager's Install via Git URL with the same URL. No pip installs, no models - the pack declares an empty dependency list and uses only what ComfyUI already ships.
The pack requires Nodes 2.0: Settings → Comfy → Nodes 2.0 → Modern Node Design (Nodes 2.0). Without it the Reference Prompt side of the pack doesn't function, and this node never gets injected in the first place.
Common issues
Black bars on some reference images. That's pad doing exactly what it promises. If the bars bother the model, reorder so the widest image is first, or move to crop and accept the cut - there is no mode that keeps everything and matches sizes.
Compositions getting cut at the edges. You're on crop. On an edit model that compares references against your prompt, a cropped reference is a reference the model can't fully see.
Which group of tags lands where. Not this node's business, but worth knowing since it's adjacent: the numbers on the Reference Prompt's outputs and thumbnails tell you the order, and order is what sets the batch's target size.
Inputs (65)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | pad | 3 options: pad, crop, stretch |
| image_1opt | IMAGE | — | |
| image_2opt | IMAGE | — | |
| image_3opt | IMAGE | — | |
| image_4opt | IMAGE | — | |
| image_5opt | IMAGE | — | |
| image_6opt | IMAGE | — | |
| image_7opt | IMAGE | — | |
| image_8opt | IMAGE | — | |
| image_9opt | IMAGE | — | |
| image_10opt | IMAGE | — | |
| image_11opt | IMAGE | — | |
| image_12opt | IMAGE | — | |
| image_13opt | IMAGE | — | |
| image_14opt | IMAGE | — | |
| image_15opt | IMAGE | — | |
| image_16opt | IMAGE | — | |
| image_17opt | IMAGE | — | |
| image_18opt | IMAGE | — | |
| image_19opt | IMAGE | — | |
| image_20opt | IMAGE | — | |
| image_21opt | IMAGE | — | |
| image_22opt | IMAGE | — | |
| image_23opt | IMAGE | — | |
| image_24opt | IMAGE | — | |
| image_25opt | IMAGE | — | |
| image_26opt | IMAGE | — | |
| image_27opt | IMAGE | — | |
| image_28opt | IMAGE | — | |
| image_29opt | IMAGE | — | |
| image_30opt | IMAGE | — | |
| image_31opt | IMAGE | — | |
| image_32opt | IMAGE | — | |
| image_33opt | IMAGE | — | |
| image_34opt | IMAGE | — | |
| image_35opt | IMAGE | — | |
| image_36opt | IMAGE | — | |
| image_37opt | IMAGE | — | |
| image_38opt | IMAGE | — | |
| image_39opt | IMAGE | — | |
| image_40opt | IMAGE | — | |
| image_41opt | IMAGE | — | |
| image_42opt | IMAGE | — | |
| image_43opt | IMAGE | — | |
| image_44opt | IMAGE | — | |
| image_45opt | IMAGE | — | |
| image_46opt | IMAGE | — | |
| image_47opt | IMAGE | — | |
| image_48opt | IMAGE | — | |
| image_49opt | IMAGE | — | |
| image_50opt | IMAGE | — | |
| image_51opt | IMAGE | — | |
| image_52opt | IMAGE | — | |
| image_53opt | IMAGE | — | |
| image_54opt | IMAGE | — | |
| image_55opt | IMAGE | — | |
| image_56opt | IMAGE | — | |
| image_57opt | IMAGE | — | |
| image_58opt | IMAGE | — | |
| image_59opt | IMAGE | — | |
| image_60opt | IMAGE | — | |
| image_61opt | IMAGE | — | |
| image_62opt | IMAGE | — | |
| image_63opt | IMAGE | — | |
| image_64opt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |