ComfyUI  >  Nodes  >  MTB Nodes >  Match Dimensions (mtb)

ComfyUI Node: Match Dimensions (mtb)

Class Name

Match Dimensions (mtb)

Category
mtb/utils
Author
melMass (Account age: 3754 days)
Extension
MTB Nodes
Latest Updated
7/2/2024
Github Stars
0.3K

How to Install MTB Nodes

Install this extension via the ComfyUI Manager by searching for  MTB Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter MTB 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

Match Dimensions (mtb) Description

Align image dimensions to match another while preserving aspect ratio for consistent image sizes and visual integrity.

Match Dimensions (mtb):

The Match Dimensions (mtb) node is designed to align the dimensions of one image to match those of another, while preserving the original aspect ratio. This is particularly useful when you need to ensure consistency in image sizes for various applications, such as creating uniform datasets or preparing images for further processing. By matching dimensions, you can avoid distortions and maintain the visual integrity of your images. The node offers flexibility by allowing you to choose whether to match the height or the width of the source image to the reference image, making it a versatile tool for image manipulation tasks.

Match Dimensions (mtb) Input Parameters:

source

The source parameter is the image whose dimensions you want to adjust. This image will be resized to match the dimensions of the reference image, either in height or width, depending on the setting of the match parameter. The source image should be provided in a compatible image format.

reference

The reference parameter is the image whose dimensions will be used as the reference for resizing the source image. The dimensions of this image will guide the resizing process to ensure that the source image matches either the height or the width of the reference image, as specified by the match parameter.

match

The match parameter determines which dimension of the source image will be adjusted to match the reference image. It accepts two options: height and width. If set to height, the source image's height will be adjusted to match the reference image's height, and the width will be scaled proportionally to maintain the aspect ratio. Conversely, if set to width, the source image's width will be adjusted to match the reference image's width, and the height will be scaled proportionally. The default value is height.

Match Dimensions (mtb) Output Parameters:

image

The image output is the resized version of the source image. This image will have its dimensions adjusted to match the specified dimension (height or width) of the reference image, while preserving the original aspect ratio.

new_width

The new_width output provides the new width of the resized source image. This value is calculated based on the aspect ratio and the specified dimension to match (height or width) of the reference image.

new_height

The new_height output provides the new height of the resized source image. This value is calculated based on the aspect ratio and the specified dimension to match (height or width) of the reference image.

Match Dimensions (mtb) Usage Tips:

  • To maintain the visual quality of your images, always ensure that the aspect ratio is preserved by using the match parameter appropriately.
  • Use the height option for the match parameter when you want to ensure that the heights of your images are consistent, which is useful for creating uniform rows of images.
  • Use the width option for the match parameter when you want to ensure that the widths of your images are consistent, which is useful for creating uniform columns of images.

Match Dimensions (mtb) Common Errors and Solutions:

"All input tensors must have the same shape when on_mismatch is 'Error'."

  • Explanation: This error occurs when the input tensors (images) do not have the same shape, and the on_mismatch parameter is set to Error.
  • Solution: Ensure that all input images have the same shape or adjust the on_mismatch parameter to either Smallest or Largest to allow automatic resizing.

"Invalid match parameter value."

  • Explanation: This error occurs when the match parameter is set to a value other than height or width.
  • Solution: Set the match parameter to either height or width to specify the dimension to match.

"Reference image not provided."

  • Explanation: This error occurs when the reference parameter is not provided.
  • Solution: Ensure that a reference image is provided to guide the resizing process.

"Source image not provided."

  • Explanation: This error occurs when the source parameter is not provided.
  • Solution: Ensure that a source image is provided to be resized.

Match Dimensions (mtb) Related Nodes

Go back to the extension to check out more related nodes.
MTB 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.