Nodes/ComfyUI_Textarea_Loaders/EmptyLatentImage_Text
ComfyUI Node

EmptyLatentImage_Text

Empty Latent Image, with only the batch size turned into a text field

By Sieyalixnet·Created 2 years ago·Updated 2 years ago· 3
EmptyLatentImage_Text
    • LATENT
    width512
    height512
    batch_size

    EmptyLatentImage_Text is the core Empty Latent Image node with a single, deliberate change: batch_size becomes a text box instead of a number widget. The README says it plainly - "ONLY make the batch size as text area." Width and height stay ordinary integer sliders.

    That makes this the thinnest node in the ComfyUI_Textarea_Loaders pack, and I'll tell you straight: if you're a human clicking through a workflow, there is no reason to use it. The number widget on the stock node is better for hand-editing. The entire point is programmatic control. If a script, an API call, or the author's companion Chrome extension is going to set "how many images do I generate this run" per job, a string you can write to is easier to drive than a number widget. Same logic as the pack's other nodes, just applied to batch count.

    How it works

    The generate method allocates a latent tensor with torch.zeros([int(batch_size), 4, height // 8, width // 8]). Two things follow from that one line.

    First, the batch size is converted with int(). So whatever you type must be a plain integer. "4" works; "4.0" throws; an empty box throws (int('') is a ValueError); "1-3" - despite the field carrying the same dynamicPrompts flag the core text encoder uses - will not survive int() either. It's a text field that only accepts a number. Keep that in mind.

    Second, the latent is 4 channels at 1/8 resolution, same as the core node - ComfyUI's VAE always downscales by 8, and the width and height here are the pixel dimensions of the eventual image. The sliders enforce the same limits as core: 16 to 16384 pixels, in steps of 8, defaulting to 512×512.

    The input and output that matter

    Two inputs are the normal integers you already know from every txt2img workflow: width and height (default 512 each). The only one that changed is batch_size - type the number of images you want, e.g. 4. The single output is LATENT, which you wire into the latent_image input of a KSampler exactly as you would with the stock node.

    How to install

    It ships with the rest of the pack, which is dependency-free - no requirements.txt, no models to download, just ComfyUI's own internals plus Pillow/numpy/torch that are already there.

    • Via ComfyUI Manager: search "ComfyUI_Textarea_Loaders", install, restart.
    • Or manually:
    cd ComfyUI/custom_nodes
    git clone https://github.com/Sieyalixnet/ComfyUI_Textarea_Loaders
    

    Restart and look under TextFormatter > BasicNodes.

    Common issues

    • Batch generation fails with a ValueError: your batch_size box is empty or not an integer. Put at least a 1 in there. It's a text field, but it only accepts a number - that's the whole personality of this node.
    • "Why is this node here?" - legit question. If you never write batch counts from outside, the stock Empty Latent Image does the same job with a nicer widget. Use this one only when the batch size is a value your automation wants to control.
    CategoryTextFormatter/BasicNodes

    Inputs (3)

    NameTypeDefaultDescription
    widthINT51216–16384The width of the latent images in pixels.
    heightINT51216–16384The height of the latent images in pixels.
    batch_sizeSTRING

    Outputs (1)

    NameTypeDescription
    LATENTLATENTThe empty latent image batch.