Image

Image[data]
represents a raster image with pixel values given by the array data.

Image[graphics]
creates a raster image from a graphics object.

Image[obj, options]
gives an image that uses the specified options.

Details and OptionsDetails and Options

  • Image[...] displays in a notebook as an image.
  • Image[data] arranges successive rows of data down the page, and successive columns across.
  • In Image[data], each element of data can specify values for any number of channels.
  • By default, elements of data are displayed as follows:
  • vgray level from 0 (black) to 1 (white)
    {r,g,b}red, green, blue values from 0 to 1
    {c1,c2,c3,...}channel values represented by equally spaced hues
  • Image[data] by default allows values of any size, but displays only values between 0 and 1.
  • Image[data, "type"] takes values of the following types:
  • "Bit"integer 0 or 1
    "Byte"integer 0 through 255
    "Bit16"integer 0 through 65535
    "Real32"single precision real (32-bit)
    "Real"double precision real (64-bit)
  • Image[data] is equivalent to Image[data, "Real"].
  • Image[data, "type"] coerces values in data to the specified type by rounding or clipping.
  • Image[image, "type"] can be used to convert between types.
  • Image takes the following options:
  • ColorSpaceAutomaticwhat color space to assume for the data
    ImageResolutionAutomaticthe resolution to use when exporting
    ImageSizeAutomaticthe default displayed size of the image
    InterleavingAutomaticwhether to assume channels are interleaved
    MagnificationAutomatichow to magnify the displayed image
    TaggingRules{}tagging rules associated with the image
  • ColorSpace->"space" specifies that values in the data should be interpreted as coordinates in a particular color space. ColorSpace->Automatic treats values as arbitrary channel intensities.
  • Bit images always have ColorSpace set to Automatic.
  • With the setting ColorSpace->"RGB", data given as is taken to include an opacity value a.
  • With the default setting Interleaving->True, Image[data, ...] takes data to be a 2D array of lists of channel values.
  • With Interleaving->False, Image[data, ...] takes data to be a list of 2D arrays of values for each channel.
  • Explicit settings for ImageSize determine the absolute size at which images should be displayed.
  • With ImageSize->Automatic, the size at which images should be displayed is determined by the setting for Magnification.
  • A setting Magnification->m specifies that each pixel in Image[...] should be displayed as an m×m block of pixels.
  • With Magnification->Automatic, smaller images are typically displayed at larger magnifications, and large images are reduced to fit within available notebook or other display areas.
  • Image[graphics] effectively uses Rasterize[graphics, "Image"] to rasterize graphics.
  • Image[Raster[...]] converts a Raster object to an image.
  • Image[Image[...], opts] effectively resets the options for an image.
  • ImageDimensions, ImageChannels, and ImageType find information on the structure of an image.

ExamplesExamplesopen allclose all

Basic Examples (6)Basic Examples (6)

Create an image object from a 3×3 array:

In[1]:=
Click for copyable input
Out[1]=

Create a real-value image from random numbers in the range 0 to 1:

In[1]:=
Click for copyable input
Out[1]=

Image with three color channels:

In[1]:=
Click for copyable input
Out[1]=

Image created from random bytes in the range 0 to 255:

In[1]:=
Click for copyable input
Out[1]=

Binary image from cellular automaton data:

In[1]:=
Click for copyable input
Out[1]=

Import an image from a file:

In[1]:=
Click for copyable input
Out[1]=

Change the image type:

In[2]:=
Click for copyable input
Out[2]=
New in 7 | Last modified in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »