# 2.11 Which Image/Graphics Formats Can MATLAB Read In?

Below is a list of functions that are available in the Image Processing Toolbox:

    bmpread     Read a BMP (Microsoft Windows Bitmap) file from disk.
    bmpwrite    Write a BMP (Microsoft Windows Bitmap) file to disk.
    gifread     Read a GIF (Graphics Interchange Format) file from disk.
    gifwrite    Write a GIF (Graphics Interchange Fromat) file to disk.
    hdfpeek     List object tag/ref pairs in HDF file.
    hdfread     Read data from HDF file.
    hdfwrite    Write data to HDF file.
    pcxread     Read a PCX (ZSoft Paint Format) file from disk.
    pcxwrite    Write a PCX (ZSoft Paint Format) file to disk.
    tiffread    Read a TIFF (Tagged Image File Format) file from disk.
    tiffwrite   Write a TIFF (Tagged Image File Format) file to disk.
    xwdread     Read a XWD (X window dump) file from disk.
    xwdwrite    Write a XWD (X window dump) file to disk.

In addition to these functions, MATLAB has two functions for reading and writing "raw" image files. They are:

    imread      Read from a "raw" image file
    imwrite     Write a "raw" image file

The "raw" image format is the format used by a program called Image Alchemy. Image Alchemy is produced by a company named Handmade Software, Inc. This program allows one to convert to and from many different formats, including TARGA, ADEX, FOP, EPS, GIF, Gem VDI, ILBM, Vivid IMG, JPEG, HP RTL, PBM, Stork, PALette, AutoLogic, Macintosh PICT, MTV, SGI, QDV, PCX, PCL, HSI Raw, Erdas Image, Sun RASter, Grasp, TIFF, QRT Raw, Utah RLE, Windows BMP, and WPG.

EXAMPLE:

    load clown
    imwrite(X,map,'filename.raw')
    % Convert it to GIF
    !alchemy -g filename.raw filename.gif
    % Convert from GIF to RAW format
    !alchemy -r filename.gif filename2.raw
    % Read it back into MATLAB and display
    clear
    [X,map] = imread('filename2.raw');
    image(X)
    colormap(map)

(c) Copyright 1994 by The MathWorks, Inc.