Importing and Exporting Image Files

  • I will usually store images in the Graphics Interchange Format (GIF). To import a GIF image into MATLAB:
    >> [x,map] = gifread('filename.gif');
    Then, matrix [x] will contain the intensity information and matrix [map] the colormap information.

  • To export an image matrix [x] and a colormap matrix [map] in a GIF format, use:
    >> gifwrite(x, map, 'filename.gif');