ImLab Scilab Function
Last update :

imwrite - saves a matrix as an image file

Calling Sequence

imwrite(filename, image_data, file format, depth)

Parameters

Description

This function writes a matrix in a file according to the matrix type. If image_data is a M*N matrix then it is saved as a PGM image file. Else, if image_data is a 3*M*N matrix then it is saved as a PPM image file, as default behaviour, but the better PNG filetype may be chosen with the third parameter). For other matrix dimensions, imwrite function returns an error message.

If the matrix contains values lower than 0 or higher than 255 (or 65535 in 16 bits depth), the image will be altered so that the lowest value is turned into a 0 and the highest value is turned into a 255 (or 65535) - 8 (or 16) bits per plan.