Empty Latent Image (Davcha)
An empty latent that hands you the upscale factor for free
- latent
- upscale_factor
- batch_size
It does the same job as the stock Empty Latent Image - make a batch of zeros in latent space for the sampler to denoise - but it's built around the two-pass workflow you actually run. Set your final canvas in width/height, pick a generation resolution in the dropdown, and the node tells you exactly how much to upscale on the second pass. For anyone who keeps doing hires-fix by hand, that's a small quality-of-life win.
It comes from comfyui_davcha, one person's drawer of ComfyUI utilities. The README is literally "Some personal QoL and experimental nodes," and this one wears that label well: nothing fancy, just a cleaner way to anchor a latent-and-upscale chain.
How it works
Under the hood it's torch.zeros([batch_size, 4, h // 8, w // 8]) - 4 channels (the standard SD/SDXL latent space), each dimension divided by 8 because that's the VAE's downscale factor. The clever part is the option dropdown. The frontend extension that ships with the pack builds it from your width/height: it finds every resolution ≥360px that keeps the same aspect ratio and lists them as 1024x1024: 1.0-style entries. The number after the colon is the upscale factor.
So you set width/height to where you eventually want the image, pick a lower, model-native resolution in option, and the latent comes out at that lower size while upscale_factor tells you the multiplier you need when you resize up later. That's the whole trick: one node that both seeds the latent and hands you the exact factor for the second pass.
Inputs and outputs that matter
- width, height (INT, 16–16384, step 8) - your final target resolution.
- option - the dynamic dropdown described above; pick the resolution the latent is actually created at.
- batch_size (INT, 1–4096) - how many latent images to make.
Outputs: latent (the empty batch, wire it to KSampler's latent_image), upscale_factor (FLOAT, the target/base ratio), and batch_size (INT, a mirror of the input in case you need it downstream).
Installing it
# ComfyUI Manager → Install Custom Nodes → search "comfyui_davcha" → Install → Restart
# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/dchatel/comfyui_davcha
cd comfyui_davcha
pip install -r requirements.txt
The pack's requirements.txt only lists webp and rapidfuzz, but nodes.py imports llama_cpp and cv2 at the top of the module. If those aren't already in your environment, the entire pack fails to import and every davcha node vanishes from the menu - fix it with pip install llama-cpp-python opencv-python and restart.
Where people get burned
The option list is built by JavaScript, so if you load a workflow in an environment where that extension didn't run (API-only calls, or the pack failing to load for the reason above), the dropdown can come up empty. Set width and height again and the frontend rebuilds it. Also keep the size math in mind: the latent is only created at option's resolution - if you feed a higher-res image into the sampler expecting it to match width/height, it won't, and the upscale factor is there so you don't have to guess why.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 51216–16384 | The width of the latent images in pixels. |
| height | INT | 51216–16384 | The height of the latent images in pixels. |
| option | COMBO | 1 options: * | |
| batch_size | INT | 11–4096 | The number of latent images in the batch. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | The empty latent image batch. |
| upscale_factor | FLOAT | — |
| batch_size | INT | — |