一个光栅图像,其像素值由数组 data 给出.




  • Image[] 在笔记本中显示为一个图像.
  • Image[data] 每页从上至下顺序设置连续的 data 行,从左至右设置连续的列.
  • Image[data] 中,data 中的每个元素可以指定任意数量的通道值.
  • data 的元素可以是以下任何一个:
  • v灰度级,从 0 (黑色) 到 1 (白色)
    {r,g,b}红色,绿色,蓝色,从 0 到 1
  • Image 视为诸如 AtomQ 的函数的原始对象处理,用于模式匹配.
  • Image[data] 默认情况下允许任何实数,但是只显示0和1之间的数值.
  • Image[data,"type"] 采用下列类型的值:
  • "Bit"整数 0 或 1
    "Byte"整数 0 到 255
    "Bit16"整数 0 到 65535
  • Image[data] 等价于 Image[data,"Real"].
  • Image[data,"type"] 通过舍入或剪切,使 data 中的值保持在指定类型.
  • Image[image,"type"] 可用于类型间的转换.
  • Image 采用下列选项:
  • ColorSpaceAutomatic假定数据的颜色空间
  • ColorSpace->"space" 指定数据中的值解释为一个特定颜色空间中的坐标. ColorSpace->Automatic 将值视为任意通道强度.
  • 位图通常把 ColorSpace 设置为 Automatic.
  • 在设置 ColorSpace->"RGB" 下,以 形式给出的数据采用一个透明度值 a.
  • 在默认设置 Interleaving->True 下,Image[data,]data 视为一个二维通道值列表 .
  • Interleaving->False 下,Image[data,]data 是为每个通道值的二维列表 .
  • ImageSize 的明确设置决定每个图像显示的绝对大小.
  • ImageSize->Automatic 下,图像显示的大小由 Magnification 的设置决定.
  • Magnification->m 指定 Image[] 中每个像素显示为一个 m×m 的像素块.
  • Magnification->Automatic 下,较小的图像通常放大显示,较大图像可以调整到现有笔记本或其它显示区域中.
  • Image[graphics] 实际上用 Rasterize[graphics,"Image"] 来栅格化 graphics.
  • Image[Raster[]] 将一个 Raster 对象转化为一个图像.
  • Image[Image[],opts] 实际上将一个图像的选项设置重设.
  • ImageDimensionsImageChannelsImageType 求出一个图像的结构信息.


  • 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.
| 2014年更新
Translate this page: