| Image Processing Toolbox | ![]() |
Reading a Graphics Image
The function imread reads an image from any supported graphics image file format, in any of the supported bit depths. Most image file formats use 8 bits to store pixel values. When these are read into memory, MATLAB stores them as class uint8. For file formats that support 16-bit data, PNG and TIFF, MATLAB stores the images as class uint16. As with MATLAB-generated images, once a image is displayed, it becomes a Handle Graphics Image object.
Note
For indexed images, imread always reads the colormap into an array of class double, even though the image array itself may be of class uint8 or uint16.
|
For example, this code reads the image ngc6543a.jpg into the MATLAB workspace as the variable RGB.
In this example, imread infers the file format to use from the contents of the file. You can also specify the file format as an argument to imread. MATLAB supports the following graphics file formats:
For the latest information concerning the bit depths and/or image formats supported, see the reference pages for imread.
| Working with Image Data | Writing a Graphics Image | ![]() |