Image Write

This function block is designed to save an input image to a specified folder with a defined filename, contingent upon an active condition. It offers options for file formats and compression.

📥 Inputs

Folder Path The path to the folder where the image will be saved.

File Name The name to be used for the saved image file.

Write Condition A boolean value that, when true, triggers the saving of the image.

Input Image The image data that will be saved.

📤 Outputs

This function block does not produce any outputs.

🕹️ Controls

Compress Image? A checkbox that allows users to choose whether to compress the saved image (if selected, the image will be saved as a JPEG with specified quality).

🎨 Features

File Format Options Supports saving images in both PNG and JPEG formats based on user preference.

Dynamic Path and Filename Users can specify the folder path and filename dynamically at runtime, using either a specific filename or a timestamp in the absence of one.

Compression Control The ability to enable or disable image compression allows for greater flexibility in image quality management.

📝 Usage Instructions

  1. Specify Folder Path: Enter the desired path for the folder where you wish to save the image.

  2. Define File Name: Input a name for your image file. If not provided, a timestamp will be used.

  3. Set Write Condition: Ensure the Write Condition input is set to True to enable saving of the image when conditions are met.

  4. Connect Input Image: Link the image data you wish to save to the Input Image input.

  5. Evaluate: Run the block, and if the Write Condition is true, the image will be saved at the specified location.

📊 Evaluation

Upon evaluation, if the Write Condition is met and the image data is valid, the function block will save the image to the specified folder with the chosen filename and format.

💡 Tips and Tricks

Using Timestamps for Filenames

If you want to save images at different times without overwriting, enter nothing in File Name input. The function will use a timestamp to create a unique filename each time an image is saved.

Ensure Folder Exists

Before running the block, ensure that your specified folder path exists. If it doesn’t, the saving operation may fail.

Compressing Images

When saving images as JPEG, enabling the Compress Image? option will reduce file size but may affect quality. Adjust the quality parameter as necessary to balance size and quality.

🛠️ Troubleshooting

No Image Data Available

Ensure that the Input Image is connected and containing valid image data. You can use the debugging feature from other blocks to verify the data flowing through.

File Path Issues

If you receive an error regarding the file path, check that the specified folder path is correct. Ensure that all directories in the given path exist before running this block.

Last updated