ComfyUI > Nodes > ComfyUI Level Pixel > Cropped Aspect Size Parameters [LP]

ComfyUI Node: Cropped Aspect Size Parameters [LP]

Class Name

CroppedAspectSizeParameters|LP

Category
LevelPixel/Inpaint
Author
LevelPixel (Account age: 647days)
Extension
ComfyUI Level Pixel
Latest Updated
2026-02-24
Github Stars
0.03K

How to Install ComfyUI Level Pixel

Install this extension via the ComfyUI Manager by searching for ComfyUI Level Pixel
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI Level Pixel 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
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Cropped Aspect Size Parameters [LP] Description

Resizes images to fit a target size while maintaining a specific aspect ratio for inpainting.

Cropped Aspect Size Parameters [LP]| Cropped Aspect Size Parameters [LP]:

The CroppedAspectSizeParameters| Cropped Aspect Size Parameters [LP] node is designed to facilitate the resizing of images while maintaining a specific aspect ratio. This node is particularly useful in scenarios where you need to adjust an image to fit within a target size, ensuring that the aspect ratio does not exceed a specified limit. By leveraging this node, you can automate the process of resizing images for inpainting tasks, making it easier to prepare images for further processing or integration into larger compositions. The node's primary goal is to provide a streamlined method for achieving consistent image dimensions, which is crucial for maintaining visual coherence in AI-generated artworks.

Cropped Aspect Size Parameters [LP]| Cropped Aspect Size Parameters [LP] Input Parameters:

mask

The mask parameter is a crucial input that defines the area of the image to be considered for resizing. It is typically a binary mask where the areas of interest are marked. This parameter directly influences the resizing process, as the node will calculate the new dimensions based on the masked region. The mask ensures that only the relevant parts of the image are resized, preserving the integrity of the content.

target_size

The target_size parameter specifies the desired size for the longest dimension of the resized image. By default, this value is set to 1024, but it can be adjusted to meet specific requirements. This parameter is essential for controlling the overall scale of the output image, ensuring that it fits within the desired dimensions while maintaining the aspect ratio.

aspect_ratio_limit

The aspect_ratio_limit parameter sets the maximum allowable aspect ratio for the resized image. This ensures that the image does not become too stretched or compressed in one dimension. The default value is 2, meaning the width can be up to twice the height or vice versa. This parameter is vital for maintaining the visual balance of the image.

crop_size_mode

The crop_size_mode parameter determines the method used for cropping the image. The default mode is "Auto," which automatically selects the best cropping strategy based on the input parameters. This parameter allows for flexibility in how the image is resized, providing options for different artistic or technical needs.

optional_context_mask

The optional_context_mask parameter is an additional mask that can be used to include or exclude specific areas from the resizing process. If provided, it must match the dimensions of the primary mask. This parameter offers an extra layer of control, allowing you to refine the areas considered during resizing.

Cropped Aspect Size Parameters [LP]| Cropped Aspect Size Parameters [LP] Output Parameters:

cropped_size_parameters

The cropped_size_parameters output provides a dictionary containing the target_height and target_width of the resized image. This output is crucial for understanding the final dimensions of the image after processing. It also includes a batch_mode flag, indicating whether the resizing was performed in batch mode, which can be important for workflows involving multiple images.

Cropped Aspect Size Parameters [LP]| Cropped Aspect Size Parameters [LP] Usage Tips:

  • To maintain the visual integrity of your images, ensure that the aspect_ratio_limit is set appropriately for your specific use case. A lower limit can prevent excessive distortion.
  • Utilize the optional_context_mask to refine the areas of the image that are resized, especially when working with complex compositions that require precise control over the resizing process.

Cropped Aspect Size Parameters [LP]| Cropped Aspect Size Parameters [LP] Common Errors and Solutions:

"optional_context_mask dimensions do not match mask dimensions"

  • Explanation: This error occurs when the dimensions of the optional_context_mask do not match those of the primary mask.
  • Solution: Ensure that both masks have the same dimensions before passing them to the node.

"max_width must be greater than or equal to min_width"

  • Explanation: This error indicates that the specified maximum width is less than the minimum width, which is not allowed.
  • Solution: Adjust the max_width and min_width parameters to ensure that the maximum width is greater than or equal to the minimum width.

"max_height must be greater than or equal to min_height"

  • Explanation: This error occurs when the specified maximum height is less than the minimum height.
  • Solution: Adjust the max_height and min_height parameters to ensure that the maximum height is greater than or equal to the minimum height.

Cropped Aspect Size Parameters [LP] Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI Level Pixel
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.