Image Resize

This function block is designed to change the dimensions of images according to specified width and height values. It offers different interpolation methods to maintain image quality during resizing.

πŸ“₯ Inputs

Image Any The input image that you wish to resize.

Width The target width for the resized image. If not specified, the original width will be used.

Height The target height for the resized image. If not specified, the original height will be used.

πŸ“€ Outputs

Image Any The resized output image with the specified dimensions.

πŸ•ΉοΈ Controls

Interpolation Method A dropdown menu that allows you to choose the method used for resizing the image. Options include:

  • INTER_NEAREST

  • INTER_LINEAR

  • INTER_AREA

  • INTER_CUBIC

  • INTER_LANCZOS4

🎨 Features

Flexible Dimension Adjustment The block allows users to specify new width and height values as needed, or simply use the original dimensions.

Various Interpolation Options Choose from different interpolation methods to ensure the quality of the resized image, depending on your requirements.

πŸ“ Usage Instructions

  1. Input Image: Connect an image to the Image Any input.

  2. Set Dimensions: Optionally, specify a width and height using the respective inputs. If left empty, the original image dimensions will be retained.

  3. Choose Interpolation Method: Select the desired interpolation method from the dropdown.

  4. Resize Image: Upon evaluation, the image will be resized according to the specified parameters.

πŸ“Š Evaluation

When executed, this function block will resize the input image based on the specified width and height and return the resized image.

πŸ’‘ Tips and Tricks

Choosing the Right Interpolation
  • For upscaling, prefer methods like INTER_CUBIC or INTER_LANCZOS4 for better quality.

  • For downscaling, INTER_AREA is generally preferable as it provides good quality for smaller images.

Retaining Aspect Ratio

If you want to maintain the aspect ratio of the original image, calculate the new height based on the width by using the formula:

new_height = original_height * (new_width / original_width)
Integration with Other Blocks

Consider combining this block with the Show Image block afterwards to visualize the resized result immediately after resizing.

πŸ› οΈ Troubleshooting

Incorrect Dimensions Error

Ensure that the specified dimensions are positive integers. If you see unexpected outputs, verify that the input dimensions do not exceed the original image size or are not negative.

Image Not Resizing

If the image does not appear to resize properly, check the connections and that a valid image is being provided to the input socket.

Last updated