Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

imread

Read image from graphics file.

Syntax

  • A = imread(filename)
  • [A, map] = imread(filename)
  • [A, map, transparency] = imread(filename)

Input argument

  • filename - a row vector characters or scalar string: name of graphics file.

Output argument

  • A - Image data: array.
  • map - Colormap: m-by-3 matrix.
  • transparency - Transparency information: matrix.

Description

imread reads the image data from the given file into a matrix.

Format Description
BMP Windows Bitmap
GIF Graphic Interchange Format (optional)
JPG Joint Photographic Experts Group
TIFF Tagged Image File Format
JPEG Joint Photographic Experts Group
PCX PiCture eXchange
PNG Portable Network Graphics
PBM Portable Bitmap
PGM Portable Graymap
PPM Portable Pixmap
XBM X11 Bitmap
XPM X11 Pixmap

Example

f = figure();
filename = [tempdir, 'ngc6543a.gif'];
websave(filename, 'https://solarviews.com/raw/ds/ngc6543a.gif');
img = imread(filename);
imagesc(img);

See also

imagesc, imformats.

History

VersionDescription
1.0.0initial version
1.13.0pcx, tiff formats added

Author

Allan CORNET