ComfyUI > Nodes > ComfyUI-RMBG > Image Crop (RMBG) 🖼️

ComfyUI Node: Image Crop (RMBG) 🖼️

Class Name

AILab_ImageCrop

Category
🧪AILab/🖼️IMAGE
Author
1038lab (Account age: 1116days)
Extension
ComfyUI-RMBG
Latest Updated
2026-02-03
Github Stars
1.89K

How to Install ComfyUI-RMBG

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

Image Crop (RMBG) 🖼️ Description

Facilitates image cropping in ComfyUI, allowing aspect ratio adjustments and position-based framing.

Image Crop (RMBG) 🖼️:

The AILab_ImageCrop node is designed to facilitate the cropping of images within the ComfyUI environment, specifically tailored for AI artists who need to manipulate image dimensions efficiently. This node allows you to crop images to a desired aspect ratio or size, ensuring that the essential parts of the image are retained while unnecessary areas are removed. The cropping can be adjusted based on different positions such as center, top, bottom, left, or right, providing flexibility in how the image is framed. This functionality is particularly beneficial for preparing images for further processing or for fitting them into specific design layouts, enhancing the overall workflow in image editing and manipulation tasks.

Image Crop (RMBG) 🖼️ Input Parameters:

output_mode

The output_mode parameter determines the method used for cropping or padding the image. It can be set to options like "crop", "pad", "pad_edge", "pad_edge_pixel", or "pillarbox_blur". Each option affects how the image is adjusted to fit the desired dimensions, with "crop" focusing on cutting the image to size, while the padding options add extra space around the image to maintain its aspect ratio. This parameter is crucial for ensuring the final image meets specific size requirements without distorting its content.

crop_position

The crop_position parameter specifies the alignment of the crop within the image. Options include "center", "top", "bottom", "left", and "right". This parameter allows you to control which part of the image is prioritized during the cropping process, ensuring that important elements are not inadvertently removed. For instance, choosing "center" will crop the image equally from all sides, while "top" will keep the upper part of the image intact.

orig_width

The orig_width parameter represents the original width of the image before cropping. It is used to calculate the new dimensions and to determine how much of the image will be removed during the cropping process. This parameter is essential for maintaining the aspect ratio and ensuring that the cropped image retains its intended proportions.

orig_height

Similar to orig_width, the orig_height parameter indicates the original height of the image. It plays a critical role in determining the final dimensions of the cropped image and helps maintain the aspect ratio. By using both orig_width and orig_height, the node can accurately calculate the necessary adjustments to achieve the desired crop.

final_width

The final_width parameter sets the target width for the cropped image. It defines the horizontal dimension that the image should have after cropping, ensuring that it fits within specific design constraints or requirements. This parameter is vital for achieving consistency across multiple images or for preparing images for specific outputs.

final_height

The final_height parameter specifies the target height for the cropped image. Like final_width, it ensures that the image meets particular vertical dimension requirements. By setting both final_width and final_height, you can precisely control the size of the output image, making it suitable for various applications.

Image Crop (RMBG) 🖼️ Output Parameters:

out_image

The out_image parameter is the primary output of the node, representing the cropped version of the input image. This output is crucial for further processing or for use in design projects, as it provides the image in the desired dimensions and aspect ratio. The out_image ensures that the essential content is preserved while fitting the specified size requirements.

out_mask

The out_mask parameter, if applicable, provides a mask corresponding to the cropped image. This mask can be used for advanced editing techniques, such as selective adjustments or compositing. It is particularly useful when working with images that require precise control over specific areas, allowing for targeted modifications without affecting the entire image.

Image Crop (RMBG) 🖼️ Usage Tips:

  • To maintain the focus on a specific part of the image, use the crop_position parameter to align the crop accordingly, ensuring that important elements are not lost.
  • Experiment with different output_mode settings to see how they affect the final image, especially when dealing with images that need to fit into specific aspect ratios or layouts.

Image Crop (RMBG) 🖼️ Common Errors and Solutions:

Image dimensions mismatch

  • Explanation: This error occurs when the specified final_width and final_height do not match the aspect ratio of the original image, leading to unexpected cropping results.
  • Solution: Adjust the final_width and final_height to maintain the original aspect ratio or use padding options to fill the extra space.

Invalid crop position

  • Explanation: An invalid value for crop_position can cause the node to fail in determining the correct area to crop.
  • Solution: Ensure that the crop_position is set to one of the valid options: "center", "top", "bottom", "left", or "right".

Image Crop (RMBG) 🖼️ Related Nodes

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