ComfyUI > Nodes > ComfyUI > Resize Images by Longer Edge

ComfyUI Node: Resize Images by Longer Edge

Class Name

ResizeImagesByLongerEdge

Category
dataset/image
Author
ComfyAnonymous (Account age: 763days)
Extension
ComfyUI
Latest Updated
2026-05-13
Github Stars
112.77K

How to Install ComfyUI

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

Resize Images by Longer Edge Description

Resize images to match specified longer edge length while maintaining aspect ratio for standardizing dimensions in datasets.

Resize Images by Longer Edge:

The ResizeImagesByLongerEdge node is designed to adjust the size of images by ensuring that the longer edge of each image matches a specified length, while maintaining the original aspect ratio. This node is particularly useful for standardizing image dimensions in a dataset, which can be crucial for tasks such as training machine learning models or preparing images for display in a uniform format. By focusing on the longer edge, this node ensures that images are resized proportionally, preventing distortion and preserving the visual integrity of the content. This method is beneficial when you want to ensure that all images have a consistent maximum dimension, which can be important for both aesthetic and functional purposes in various applications.

Resize Images by Longer Edge Input Parameters:

longer_edge

The longer_edge parameter specifies the target length for the longer edge of the image. This parameter determines how the image will be resized, ensuring that the longer side of the image matches the specified length while maintaining the aspect ratio. The minimum value for this parameter is 1, and the maximum value is 8192, with a default value of 1024. Adjusting this parameter allows you to control the maximum dimension of the resized images, which can be useful for optimizing image size for specific use cases, such as reducing file size for web use or ensuring compatibility with certain display resolutions.

Resize Images by Longer Edge Output Parameters:

resized_images

The output of the ResizeImagesByLongerEdge node is a tensor containing the resized images. Each image in the output tensor has been adjusted so that its longer edge matches the specified length, while the aspect ratio is preserved. This ensures that the images maintain their original proportions, preventing any distortion. The resized images are suitable for use in various applications, such as machine learning pipelines, where consistent image dimensions are often required.

Resize Images by Longer Edge Usage Tips:

  • To maintain image quality, choose a longer_edge value that is appropriate for your specific use case. For high-resolution displays, a larger value may be necessary, while smaller values can be used to reduce file size for web applications.
  • Consider the aspect ratio of your images when setting the longer_edge parameter to ensure that the resized images meet your aesthetic or functional requirements.

Resize Images by Longer Edge Common Errors and Solutions:

Image size mismatch error

  • Explanation: This error may occur if the input images have varying dimensions that do not align with the specified longer_edge parameter.
  • Solution: Ensure that the longer_edge parameter is set to a value that is appropriate for the largest dimension of your input images to avoid unexpected resizing results.

Invalid parameter value

  • Explanation: This error occurs when the longer_edge parameter is set to a value outside the allowed range (1 to 8192).
  • Solution: Verify that the longer_edge parameter is within the specified range and adjust it accordingly to prevent this error.

Resize Images by Longer Edge Related Nodes

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

Resize Images by Longer Edge