ComfyUI > Nodes > CRT-Nodes > Quantize and Crop Image (CRT)

ComfyUI Node: Quantize and Crop Image (CRT)

Class Name

CRT_QuantizeAndCropImage

Category
CRT/Image
Author
CRT (Account age: 1707days)
Extension
CRT-Nodes
Latest Updated
2026-03-16
Github Stars
0.1K

How to Install CRT-Nodes

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

Quantize and Crop Image (CRT) Description

Efficiently resizes, crops, and quantizes images to fit specified dimensions while preserving aspect ratio.

Quantize and Crop Image (CRT):

The CRT_QuantizeAndCropImage node is designed to efficiently resize and crop images to fit within specified dimensions while maintaining the original aspect ratio as closely as possible. This node is particularly useful for preparing images for further processing or display, ensuring they conform to specific size constraints without distorting the image's proportions. By leveraging a set of predefined size buckets, the node quantizes the image dimensions to the nearest suitable size, then resizes the image using bicubic interpolation for smooth scaling. Finally, it crops the image to the target dimensions, centering the crop to preserve the most important parts of the image. This process ensures that the final output is both visually appealing and optimized for the intended use, making it an essential tool for AI artists who need to manage image dimensions effectively.

Quantize and Crop Image (CRT) Input Parameters:

image

The image parameter is the input image that you want to resize and crop. It is expected to be in a format that the node can process, typically a tensor with dimensions representing batch size, height, width, and color channels. This parameter is crucial as it serves as the primary data that the node will manipulate to produce the desired output.

max_side_length

The max_side_length parameter defines the maximum allowable size for either the width or height of the final image. It ensures that the output image does not exceed this size, which is particularly useful for maintaining consistency across different images or preparing images for environments with size constraints. The default value is 1024 pixels, with a minimum of 256 and a maximum of 8192 pixels, adjustable in increments of 64 pixels. This parameter helps control the scale of the output image, balancing between detail and performance.

Quantize and Crop Image (CRT) Output Parameters:

image

The image output is the processed image that has been resized and cropped according to the specified parameters. This output maintains the original aspect ratio as closely as possible while fitting within the defined maximum dimensions, ensuring that the image is ready for further use or display.

width

The width output provides the final width of the processed image. This value is determined by the quantization and cropping process, ensuring that the image fits within the specified constraints while maintaining its aspect ratio.

height

The height output indicates the final height of the processed image. Similar to the width, this value results from the quantization and cropping process, ensuring that the image adheres to the specified size constraints while preserving its aspect ratio.

Quantize and Crop Image (CRT) Usage Tips:

  • To maintain the best quality, choose a max_side_length that closely matches the intended display size of the image to avoid unnecessary scaling.
  • Use this node to prepare images for environments with strict size requirements, such as web applications or mobile devices, ensuring consistent presentation.

Quantize and Crop Image (CRT) Common Errors and Solutions:

Image shape mismatch

  • Explanation: The input image does not have the expected dimensions or format.
  • Solution: Ensure that the input image is a tensor with dimensions representing batch size, height, width, and color channels.

Invalid max_side_length value

  • Explanation: The max_side_length parameter is set outside the allowed range.
  • Solution: Adjust the max_side_length to be within the range of 256 to 8192 pixels, using increments of 64 pixels.

Quantize and Crop Image (CRT) Related Nodes

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

Quantize and Crop Image (CRT)