Resize Image
Resizes an image to specified dimensions with optional aspect ratio preservation.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- In Path - Path to the input image file.
- Width - Target width for the resized image in pixels. Must be greater than zero.
- Height - Target height for the resized image in pixels. Must be greater than zero.
- Out Path - Path where the resized output image will be saved.
Options
- Ignore Aspect Ratio - If true, the image will be stretched to fit the specified dimensions. If false, the aspect ratio will be preserved and the image will be resized to fit within the specified dimensions. Default is true.
Output
- result - Boolean indicating success or failure of the resize operation.
How It Works
The Resize Image node uses ImageMagick library to change the dimensions of an image. When executed, the node:
- Validates input and output file paths
- Validates that width and height values are greater than zero
- Loads the specified input image
- Creates resize properties based on the specified dimensions
- Applies the resize operation with or without aspect ratio preservation based on the option
- Saves the resized image to the output path
Requirements
- Valid input image file at the specified path
- Output path must be writable
- Width and height values must be positive integers
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid input file path
- Input file not found at the specified path
- Width value less than or equal to zero
- Height value less than or equal to zero
- Empty or invalid output file path
Usage Notes
- When "Ignore Aspect Ratio" is false, the image will be resized to fit within the specified dimensions while maintaining its original aspect ratio
- When "Ignore Aspect Ratio" is true, the image will be stretched to exactly match the specified dimensions
- Processing time depends on the size difference between input and output images
- Image quality may be affected when resizing, especially when significantly increasing dimensions
- Useful for:
- Preparing images for web display
- Creating thumbnails
- Standardizing image sizes for processing
- Reducing file sizes
- The output image format is determined by the file extension in the Out Path
- Metadata is generally preserved during resizing
- For best results when upscaling, consider using specialized upscaling algorithms not available in this node