ComfyUI > Nodes > Mikey Nodes > Preset Ratio Selector (Mikey)

ComfyUI Node: Preset Ratio Selector (Mikey)

Class Name

PresetRatioSelector

Category
Mikey/Utils
Author
bash-j (Account age: 4196days)
Extension
Mikey Nodes
Latest Updated
2024-06-15
Github Stars
0.08K

How to Install Mikey Nodes

Install this extension via the ComfyUI Manager by searching for Mikey Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Mikey Nodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Preset Ratio Selector (Mikey) Description

Manage and select predefined aspect ratios for AI art projects with customizable presets and random selection seed.

Preset Ratio Selector (Mikey):

The PresetRatioSelector node is designed to help you manage and select predefined aspect ratios for your AI art projects. This node allows you to choose from a list of preset ratios, which can be customized and extended by the user. By leveraging these presets, you can ensure consistency and precision in your artwork dimensions, making it easier to achieve the desired visual effects. The node also supports the use of a seed to randomly select a preset, adding an element of variability and creativity to your work. This functionality is particularly useful for artists who want to experiment with different aspect ratios without manually adjusting settings each time.

Preset Ratio Selector (Mikey) Input Parameters:

preset

This parameter allows you to select a predefined aspect ratio from a list of available presets. The options include various common aspect ratios, and you can also add your own custom presets. The default value is "none", which means no preset is selected. Selecting a preset will automatically adjust the dimensions of your artwork according to the chosen ratio.

swap_axis

This parameter lets you swap the width and height of the selected aspect ratio. It accepts two values: "true" and "false", with the default being "false". Swapping the axis can be useful when you want to quickly change the orientation of your artwork from landscape to portrait or vice versa.

select_latent_ratio

This parameter allows you to choose a latent ratio from a list of predefined sizes. If you select "custom", you can manually specify the width and height using the custom_latent_w and custom_latent_h parameters. The default value is the first ratio in the list.

custom_latent_w

This parameter specifies the custom width for the latent ratio when select_latent_ratio is set to "custom". It accepts integer values ranging from 0 to 8192, with a default value of 0. This allows you to define a specific width for your custom latent ratio.

custom_latent_h

This parameter specifies the custom height for the latent ratio when select_latent_ratio is set to "custom". It accepts integer values ranging from 0 to 8192, with a default value of 0. This allows you to define a specific height for your custom latent ratio.

select_cte_ratio

This parameter allows you to choose a CTE (Content-Aware Transformation Engine) ratio from a list of predefined sizes. If you select "custom", you can manually specify the width and height using the cte_w and cte_h parameters. The default value is the first ratio in the list.

cte_w

This parameter specifies the custom width for the CTE ratio when select_cte_ratio is set to "custom". It accepts integer values ranging from 0 to 8192, with a default value of 0. This allows you to define a specific width for your custom CTE ratio.

cte_h

This parameter specifies the custom height for the CTE ratio when select_cte_ratio is set to "custom". It accepts integer values ranging from 0 to 8192, with a default value of 0. This allows you to define a specific height for your custom CTE ratio.

cte_mult

This parameter is a multiplier for the CTE dimensions. It accepts float values ranging from 0.0 to 100.0, with a default value of 0.0. Applying a multiplier can help you scale the CTE dimensions proportionally.

cte_res

This parameter specifies the resolution for the CTE dimensions. It accepts integer values ranging from 0 to 8192, with a default value of 0. Setting a resolution can help you achieve a specific level of detail in your artwork.

cte_fit_size

This parameter allows you to fit the CTE dimensions to a specific size. It accepts integer values ranging from 0 to 8192, with a default value of 0. This can be useful for ensuring that your artwork fits within certain size constraints.

select_target_ratio

This parameter allows you to choose a target ratio from a list of predefined sizes. If you select "custom", you can manually specify the width and height using the target_w and target_h parameters. The default value is the first ratio in the list.

target_w

This parameter specifies the custom width for the target ratio when select_target_ratio is set to "custom". It accepts integer values ranging from 0 to 8192, with a default value of 0. This allows you to define a specific width for your custom target ratio.

target_h

This parameter specifies the custom height for the target ratio when select_target_ratio is set to "custom". It accepts integer values ranging from 0 to 8192, with a default value of 0. This allows you to define a specific height for your custom target ratio.

target_mult

This parameter is a multiplier for the target dimensions. It accepts float values ranging from 0.0 to 100.0, with a default value of 0.0. Applying a multiplier can help you scale the target dimensions proportionally.

crop_w

This parameter specifies the width for cropping the final output. It accepts integer values ranging from 0 to 8192, with a default value of 0. Cropping can help you remove unwanted parts of the image and focus on the main subject.

crop_h

This parameter specifies the height for cropping the final output. It accepts integer values ranging from 0 to 8192, with a default value of 0. Cropping can help you remove unwanted parts of the image and focus on the main subject.

use_preset_seed

This parameter determines whether to use a seed to randomly select a preset. It accepts two values: "true" and "false", with the default being "false". Using a seed can add an element of randomness and creativity to your artwork by selecting different presets each time.

seed

This parameter specifies the seed value used for random selection of presets. It accepts integer values and is used only when use_preset_seed is set to "true". The seed ensures that the same preset is selected each time for a given seed value, providing reproducibility.

unique_id

This optional parameter allows you to specify a unique identifier for the operation. It can be useful for tracking and managing different operations within a project.

extra_pnginfo

This optional parameter allows you to include additional PNG metadata information. It can be useful for embedding extra details or annotations within the image file.

prompt

This optional parameter allows you to specify a prompt for the operation. It can be useful for guiding the AI in generating specific content based on the provided prompt.

Preset Ratio Selector (Mikey) Output Parameters:

samples

The output parameter samples contains the generated latent samples based on the selected or custom aspect ratios. These samples are tensors that represent the dimensions and content of your artwork. The latent samples are crucial for further processing and transformations in your AI art pipeline, providing the foundational structure for your final output.

Preset Ratio Selector (Mikey) Usage Tips:

  • To achieve consistent aspect ratios across multiple artworks, make use of the preset selection feature.
  • Experiment with the use_preset_seed parameter to introduce variability and discover new aspect ratios that might enhance your creative process.
  • Utilize the swap_axis parameter to quickly switch between landscape and portrait orientations without manually adjusting dimensions.
  • When working with custom ratios, ensure that the custom_latent_w and custom_latent_h parameters are set to appropriate values to avoid unexpected results.

Preset Ratio Selector (Mikey) Common Errors and Solutions:

"FileNotFoundError: [Errno 2] No such file or directory: 'ratio_presets.json'"

  • Explanation: This error occurs when the ratio_presets.json file is missing or not found in the expected directory.
  • Solution: Ensure that the ratio_presets.json file is present in the correct directory. If the file is missing, create it or obtain it from the appropriate source.

"KeyError: 'ratio_presets'"

  • Explanation: This error occurs when the ratio_presets key is missing in the JSON file.
  • Solution: Verify that the ratio_presets.json file contains the ratio_presets key with the appropriate structure. Update the file if necessary to include the missing key.

"ValueError: Invalid value for parameter 'select_latent_ratio'"

  • Explanation: This error occurs when an invalid value is provided for the select_latent_ratio parameter.
  • Solution: Ensure that the value for select_latent_ratio is one of the predefined sizes or "custom". Check the available options and select a valid value.

"TypeError: unsupported operand type(s) for -: 'int' and 'list'"

  • Explanation: This error occurs when there is a type mismatch in the calculation involving the seed and the list of presets.
  • Solution: Ensure that the seed value is an integer and that the list of presets is correctly defined. Debug the code to identify and fix the type mismatch issue.

Preset Ratio Selector (Mikey) Related Nodes

Go back to the extension to check out more related nodes.
Mikey Nodes
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.