0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions114

Image → Resize

AI-generated

Overview

This node operation resizes an image based on specified dimensions and options. It supports input images provided either as a publicly accessible URL or as a buffer. Users can specify the target width and height, the resizing fit mode (such as contain, cover, fill, inside, outside), and the kernel algorithm (such as nearest, cubic, mitchell, lanczos2, lanczos3) to control the resizing quality and behavior. The node can output the resized image either as a URL or in another specified format.

Use Case Examples

  1. Resize a product image to fit within a 300x300 pixel box while maintaining aspect ratio using the 'contain' fit mode.
  2. Resize a user-uploaded image buffer to a fixed width and height with a specific kernel for smoother scaling.

Properties

Name Meaning
Code Variables Allows setting custom code variables defined in the code editor for the selected function, useful for dynamic parameterization.
Type of Data Specifies whether the input image is provided as a URL or a buffer.
URL The publicly accessible URL of the image to resize. Required if 'Type of Data' is set to URL.
Buffer The buffer string of the image to resize. Required if 'Type of Data' is set to Buffer.
Width The target width to resize the image to.
Height The target height to resize the image to.
Fit The resizing fit mode that controls how the image is fitted to the specified dimensions. Possible values include 'contain', 'cover', 'fill', 'inside', and 'outside'.
Kernel The kernel algorithm used for resizing to control quality and scaling behavior. Possible values include 'nearest', 'cubic', 'mitchell', 'lanczos2', and 'lanczos3'.
File Name Optional filename of the image to operate on, useful for output naming.
Get File as URL Boolean flag indicating whether to get the resulting image as a URL.

Output

JSON

  • url - URL of the resized image if 'Get File as URL' is true and input was URL.
  • buffer - Buffer of the resized image if input was provided as buffer or output is not URL.
  • fileName - Filename of the resized image if specified.

Dependencies

  • An API key credential for the CodeKit API is required to authenticate requests.

Troubleshooting

  • Ensure the input image URL is publicly accessible if using URL input type; private or protected URLs will cause failures.
  • If using buffer input, verify the buffer string is correctly formatted and valid image data.
  • Check that width and height parameters are positive numbers; invalid dimensions may cause errors.
  • If the node throws errors related to unsupported fit or kernel values, verify that the values are among the allowed options.
  • Network or API authentication errors may occur if the API key credential is missing or invalid; ensure proper credential configuration.

Discussion