KJNodes/latentsgenerated

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

Latent
Width
Height
dimensions
COMBO
invert
batch_size
1
KJNodes

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

ParameterTypeRequiredDefaultRange/OptionsDescription
dimensionsCOMBOYes-Preset optionsSelect image dimensions from a preset list loaded from custom_dimensions.json.
invertBOOLEANYesFalse-When True, swaps the width and height values of the selected preset.
batch_sizeINTYes11 - 4096Number of latent images to generate in a batch.

Output

NameTypeDescription
LatentLATENTThe generated empty latent image tensor.
WidthINTThe final image width in pixels.
HeightINTThe 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.

Loading comments…