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.
  • Elements of data can be either of the following:
  • vrendered as gray level from 0 (black) to 1 (white)
    {r,g,b}rendered as red, green, blue values from 0 to 1
    {c1,c2,c3,}channel values rendered by equally spaced hues
    colorspecific color
  • Image is treated as a raw object by functions like AtomQ, and for purposes of pattern matching.
  • Image[data] by default allows any real number, 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
    ImageSizeAutomaticdisplay size of the image
    InterleavingAutomaticwhether to assume channels are interleaved
    MagnificationAutomatichow to magnify the displayed image
    MetaInformation{}meta-information associated with the 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.

Background
Background

  • Image provides unified symbolic representation for a large variety of digital image formats (e.g., GIF, PNG, JPG) as found on the internet and elsewhere. In particular, an Image object contains a two-dimensional array of values (or lists of values) that represents a raster image. Images are commonly encountered in digital photography, digitization of text and pictures, scientific visualization, and a wide variety of other fields. The data inside an image may take on a variety of values depending on if the image is binary, grayscale, RGB, CMYK, includes an alpha channel, etc.
  • Upon output, an Image formats as a picture of the actual image, not as a 2D array of values. Image objects may be exported to a variety of standard image formats using Export, and images in a number of formats may be imported as Image objects using Import. Image objects may also be inserted into a notebook by drag-and-drop from external applications.
  • An arbitrary Graphics expression may be converted to an image by applying the function Image to it. Similarly, an image may be converted to a raster expression suitable for display with other Graphics primitives by applying Raster to it. The function Show can be used to combine 2D vector graphics (or Graphics objects) with Image objects.
  • The array of pixel values in an image may be obtained using ImageData. ImageDimensions gives the pixel dimensions of the raster associated with an Image object. ImageType gives a label representing the number type used internally to represent each pixel of an image. Image itself can be used to convert between image types, and ImageAdjust can be used to bring all values of a real-valued image into the range 0 to 1. The number of channels the image contains may be obtained using the function ImageChannels.
  • Options useful for Image objects include ColorSpace, Interleaving, ImageResolution, ImageSize, and Magnification.
Introduced in 2008
(7.0)
| Updated in 2014
(10.0)