Functions to read and save images. The governing philosophy is to retain all the precision of the file format during loading, and to choose a format capable of representing in-memory images during save operations.
Load(fileName, subImageIndex = 0)
The file format is automatically determined, and the returned Image has a precision large enough to represent the contents of the file. Practically, this means that images with 8 bits per channel (including color-mapped images) are read in as Fractional images, and all others are read in as Float images.
Most popular file formats are recognized and read in correctly. The following file formats can be read:
Name of file to be loaded (string)
Index of subimage (for multi-image files)
Save image to file using specified format. If a format is not specified, an appropriate choice will be used. This function throws ice.error for failure.
Name of file to save to (string).
Output format (int). Can be one of:
Note: It is worth mentioning that dithering is not done automatically while saving to a lower-precision format.
The FMT_JPEG format looks at the image's meta-data dictionary to determine the "quality" factor of the output image. The "quality" of a JPEG image is a number between 1 and 100.