ComfyUI > Nodes > ComfyUI > Random Crop Images

ComfyUI Node: Random Crop Images

Class Name

RandomCropImages

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

Random Crop Images Description

Enhance image processing workflow with random cropping for data augmentation and model robustness.

Random Crop Images:

The RandomCropImages node is designed to enhance your image processing workflow by providing a method to randomly crop images to specified dimensions. This node is particularly useful for data augmentation, a technique often employed in machine learning to increase the diversity of your training dataset without actually collecting new data. By randomly cropping images, you can simulate different perspectives and compositions, which can help improve the robustness and generalization of your models. The node ensures that each crop is unique by utilizing a random seed, allowing for reproducibility when needed. This capability is essential for creating varied datasets that can lead to more accurate and reliable AI models.

Random Crop Images Input Parameters:

width

The width parameter specifies the width of the cropped area in pixels. It determines how wide the resulting cropped image will be. The minimum value is 1, the maximum is 8192, and the default is set to 512. Adjusting this parameter allows you to control the horizontal dimension of the crop, which can be useful for focusing on specific parts of an image or ensuring consistency across a dataset.

height

The height parameter defines the height of the cropped area in pixels. It sets the vertical dimension of the resulting cropped image. Similar to the width, the minimum value is 1, the maximum is 8192, and the default is 512. This parameter is crucial for controlling the vertical aspect of the crop, enabling you to tailor the image's composition to your specific needs.

seed

The seed parameter is used to initialize the random number generator, ensuring that the cropping process can be reproduced if needed. The seed value ranges from 0 to 18,446,744,073,709,551,615, with a default of 0. By setting a specific seed, you can achieve consistent cropping results across different runs, which is particularly useful for debugging or when you need to maintain a consistent dataset for training purposes.

Random Crop Images Output Parameters:

image

The output parameter is the image, which is the cropped version of the input image. This output retains the specified width and height dimensions, providing a new perspective or focus area of the original image. The cropped image can be used for various applications, such as training machine learning models, creating artistic compositions, or simply exploring different visual aspects of an image.

Random Crop Images Usage Tips:

  • To ensure reproducibility in your experiments, use a fixed seed value when cropping images. This will allow you to obtain the same cropped results across different runs.
  • Experiment with different width and height values to explore various compositions and perspectives in your images, which can be particularly beneficial for artistic projects or enhancing model training datasets.

Random Crop Images Common Errors and Solutions:

Image size is smaller than crop dimensions

  • Explanation: This error occurs when the specified crop dimensions (width or height) exceed the dimensions of the input image.
  • Solution: Ensure that the crop dimensions are smaller than or equal to the dimensions of the input image. Adjust the width and height parameters accordingly.

Invalid seed value

  • Explanation: This error arises when the seed value is set outside the allowable range.
  • Solution: Verify that the seed value is within the range of 0 to 18,446,744,073,709,551,615. Adjust the seed value to fall within this range.

Random Crop Images 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.

Random Crop Images