SIVP Toolbox
Last update : July, 2005

imread - Reads image file

### Calling Sequence

  `im = imread(filename)`

### Parameters

- `filename`: A string, the image filename to be read. The extension determines the type of the image.
- `im`: All images will be converted to gray images or RGB images. For gray images, this is a MxN unsigned char matrix; For RGB images, this is a MxNx3 unsigned char matrix.

### Description

`imread` reads many types of image files into Scilab. The format of the file is inferred from the extension in the filename parameter. Currently the following file formats are supported:

  * Windows bitmaps - BMP, DIB;
  * JPEG files - JPEG, JPG, JPE;
  * Portable Network Graphics - PNG;
  * Portable image format - PBM, PGM, PPM;
  * Sun rasters - SR, RAS;
  * TIFF files - TIFF, TIF.

im = imread(filename)
  reads image in filename into `im` matrix. If filename contains a truecolor image, `im` is a MxNx3 hypermatrix, so for example `im(:,:,1)` stands for the red channel. For gray images, im is a MxNx1 unsigned char matrix.

### Examples

        im = imread(SCI + '/contrib/sivp/images/lena.png');
        imshow(im);

### Bugs and Shortcomings

Images with a palette are not supported. All kinds of images are converted to gray images or RGB images.

### Authors

  Shiqi Yu <shiqi.yu[at]gmail.com>

### Availability

The latest version of SIVP can be found at

http://sivp.sourceforge.net

### See Also

`imwrite`, `imshow`, `imfinfo`,