Save image🔗

Writes images into files. This tool supports most standard image formats and a proprietary kuva format. The kuva format is the only format that supports raw image data and is guaranteed to preserve all information, including calibration coefficients.

@note This tool will be run simultaneously in multiple processing threads. Due to this, incoming images may be written to the hard disk in arbitrary order. Don’t expect auto-numbered images to be written to the disk in the order they were received by the tool. If you need a serial number in file names, generate the names using a script that maintains a counter in its state variables.


  • image: The image to save.

  • filePath: A relative or absolute path to the output files. The filePath input can contain both a path and a file name. However, if fileName input contains a non-empty value, filePath input is treated as a directory and the fileName input defines the filename in it. A trailing slash is not required in filePath in that case. See also autoNumber input.

  • fileName: A file name to be appended to the filePath input. A directory separator is automatically inserted in between, if necessary.

  • format: The file format. In Automatic mode, the format is deduced from the file name suffix in filePath, if one exists. If no suffix is given in filePath, the format will be used as a suffix in the generated file names. For example, if filePath is “/tmp/” and format is “jpg”, the generated file names will be “/tmp/1.jpg”, “/tmp/2.jpg” etc. If automatic deduction fails, the default format will be “kuva”.

  • compressionLevel: Sets the level of compression when saving an image. The effect of the compression level depends on the selected image format. For example, tiff images support two alternatives: no compression or LZW compression. With the tiff format, any compression level higher than zero will turn on LZW compression. With the jpeg format, even a compression level of zero means that the image will be compressed, but quality will be preferred over compression ratio as much as possible. If the selected image format does not support compression, this value will be ignored. Setting compressionLevel to -1 uses default settings for the selected image format.

  • autoNumber: Toggles automatic numbering of output images. If this option is enabled, the tool automatically inserts a numeric suffix to the image file names to prevent overwriting existing files. Note that the incoming images are not guaranteed to be numbered in the order they were received; automatic numbering guarantees just a unique file name for each image.

    Let’s call the path composed by combining the filePath and fileName inputs “path” and assume autoNumber is enabled. Now, if path is “images/”, the tool will write “images/1.kuva”, “images/2.kuva” etc. If path is “image”, the generated file names will be “image1.kuva”, “image2.kuva” etc. If path contains a file name extension (identified by a dot after the last path component), the numeric suffix will be appended to the preceding part. For example, if path is “C:/temp/img.kuva”, auto-numbered names will be “C:/temp/img1.kuva” etc.

  • overwrite: Toggles overwriting of existing files. If overwriting is disabled and the file being written already exists, the success output will be set to false.

  • autoCreateDirectory: A flag that controls automatic creation of directories. If the output directory does not exist and this option is enabled, the tool will try to create the directory automatically.


  • filePath: Absolute path to the image file.

  • success: true if the image was successfully written and false otherwise.