Empty Latent Image Custom Presets(EmptyLatentImageCustomPresets)
Reads preset dimension options from a custom_dimensions.json configuration file and generates an empty latent image at the specified size.
Empty Latent Image Custom Presets
Empty Latent Image Custom Presets is a node that reads preset dimension options from a custom_dimensions.json configuration file located in the same directory and generates an empty latent image at the specified size.
This node allows users to select an image resolution from a predefined list and supports batch generation, providing an initial latent space representation for subsequent image generation workflows.
Functionality
The node reads preset dimension options from a custom_dimensions.json file in the same directory, parsing the selected preset into width and height values. It uses ComfyUI's built-in EmptyLatentImage functionality to create an empty latent tensor of the specified dimensions, with an option to swap width and height.
Parameters - Empty Latent Image Custom Presets
Widget Parameters
| Parameter | Type | Required | Default | Range/Options | Description |
|---|---|---|---|---|---|
dimensions | COMBO | Yes | - | Preset options | Select image dimensions from a preset list loaded from custom_dimensions.json. |
invert | BOOLEAN | Yes | False | - | When True, swaps the width and height values of the selected preset. |
batch_size | INT | Yes | 1 | 1 - 4096 | Number of latent images to generate in a batch. |
Output
| Name | Type | Description |
|---|---|---|
| Latent | LATENT | The generated empty latent image tensor. |
| Width | INT | The final image width in pixels. |
| Height | INT | The final image height in pixels. |
Use cases
This node is useful in workflows that require fixed-size images. For example, when batch-generating social media avatars or wallpapers with specific aspect ratios, you can preconfigure common dimensions and use this node to produce empty latents at the right size before connecting to a KSampler or other sampling node.
Notes
The available dimensions depend entirely on the external custom_dimensions.json configuration file. If this file is missing or malformed, the node will not provide any preset options.
Source code
Empty Latent Image Custom Presets is part of the ComfyUI-KJNodes node pack.
Comments
Sign in with GitHub to join the discussion.