Reading and writing grayscale images

READ_IMAGE(filename) Returns the contents of image file filename (BMP, GIF, JPG, TGA, PCX, PBM, PGM, PPM, or TIF) as a grayscale image matrix.

WRITEBMP(filename.extension) := M or
Dummy := WRITERGB(filename.extension, M) Writes grayscale image matrix M to image file filename, with format determined by the file extension (BMP, PPM, or TIF). This function can be used either on the right or the left side of the definition operator. When used on the right, you must supply the argument M, the name of the matrix to write to the file. In this case, the function returns 0. When used on the left, do not supply the argument M, but instead place it on the right hand side of the definition.

Arguments: