This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

ImageData

ImageData[image]
gives the array of pixel values in image.
ImageData[image, "type"]
gives the array of pixel values converted to the specified type.
  • ImageData[image] by default gives a 2D array whose elements are lists of values for each channel.
  • The array generated by ImageData[image] is arranged in the same way that the image is displayed, with the first row corresponding to the top row of pixels in the image.
  • For binary images, ImageData[image] returns integer values 0 or 1. For all other images, ImageData[image] returns real values, normally between 0 and 1.
  • Possible types specified by ImageData[image, "type"] are:
"Bit"integer 0 or 1
"Byte"integer 0 through 255
"Bit16"integer 0 through 65535
"Real"machine real
  • For images of type "Byte" or "Bit16", ImageData[image] always normalizes values to lie between 0 and 1. For images of type "Real", ImageData[image] returns whatever real values are used in the image.
Channel data for the first five pixels of the first row:
Construct a byte-valued image:
Extract normalized raster data:
Extract raw bytes:
Channel data for the first five pixels of the first row:
In[1]:=
Click for copyable input
Out[1]=
 
Construct a byte-valued image:
In[1]:=
Click for copyable input
Out[1]=
Extract normalized raster data:
In[2]:=
Click for copyable input
Out[2]=
Extract raw bytes:
In[3]:=
Click for copyable input
Out[3]=
Data of multi-channel images is by default returned in interleaved form:
This gives the pixel data in planar form:
New in 7