| Image Processing Toolbox | ![]() |
Reading a Graphics Image
The function imread reads an image from any supported graphics image file in any of the supported bit depths. Most of the images that you will read are 8-bit. When these are read into memory, MATLAB stores them as class uint8. The main exception to this rule is that MATLAB supports 16-bit data for PNG and TIFF images. If you read a 16-bit PNG or TIFF image, it will be stored as class uint16.
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.
|
To see the many syntax variations for reading an image, see the reference entry for imread. For our discussion here we will show one of the most basic syntax uses of imread. This example reads the image ngc6543a.jpg.
RGB = imread('ngc6543a.jpg');
You can write image data using the imwrite function. The statements
load clown imwrite(X,map,'clown.bmp')
create a BMP file containing the clown image.
| Working with Image Data | Writing a Graphics Image | ![]() |