MATLAB, or Matrix Laboratory, is a powerful computational tool designed for the manipulation of matrices. Because digital pictures are stored as matrices representing the pixels in the pictures, MATLAB is an ideal way to manipulate pictures on a fundamental level. When you've finished your work with a picture in MATLAB, use the "imwrite" function to save your altered picture to a file.
Call "imwrite" in the simplest way as follows:
Here, "x" is the matrix to be stored as a picture, "test.jpg" is the name of the file to save to and "jpg" is the format to use. Type the "imformats" command to see a list of picture formats compatible with your installation of MATLAB.
Insert an argument after the first to specify a color map if your picture format calls for it:
Here, "m" is the variable containing the color map.
Add optional arguments to the end of the list to specify parameters specific to your picture format:
This example defines which color in the color map -- "m" -- will be transparent in the saved GIF file. Consult the MATLAB documentation, or type "help imwrite," to find information about the optional parameters for various picture formats.