({{, (RefLink[Image, paclet:ref/Image])[data] 
represents a raster image with pixel values given by the array data.}, {, (RefLink[Image, paclet:ref/Image])[graphics]
creates a raster image from a graphics object. }, {, (RefLink[Image, paclet:ref/Image])[obj,options]
gives an image that uses the specified options.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[Image, paclet:ref/Image])[…] displays in a notebook as an image.

(RefLink[Image, paclet:ref/Image])[data] arranges successive rows of data down the page, and successive columns across.

In (RefLink[Image, paclet:ref/Image])[data], each element of data can specify values for any number of channels.

Elements of data can be either of the following:

The input array data can be given as a (RefLink[List, paclet:ref/List]), (RefLink[NumericArray, paclet:ref/NumericArray]), (RefLink[SparseArray, paclet:ref/SparseArray]), etc.

(RefLink[Image, paclet:ref/Image])[data] by default allows any real number, but displays only values between 0 and 1.

(RefLink[Image, paclet:ref/Image])[data,"type"] can be used to create an image of a specified data type. Values in data are coerced to the specified type by rounding or clipping. By default, "Real32" is assumed.

Possible settings for "type" include:

(RefLink[Image, paclet:ref/Image])[image,"type"] can be used to convert between types.

(RefLink[Image, paclet:ref/Image]) is treated as a raw object by functions like (RefLink[AtomQ, paclet:ref/AtomQ]), and for purposes of pattern matching.

The following options can be specified:

(RefLink[ColorSpace, paclet:ref/ColorSpace])->cs specifies that values in the data should be interpreted as coordinates in a particular color space cs. (RefLink[ColorSpace, paclet:ref/ColorSpace])->(RefLink[Automatic, paclet:ref/Automatic]) treats values as arbitrary channel intensities.

(RefLink[Image, paclet:ref/Image])[graphics] effectively uses (RefLink[Rasterize, paclet:ref/Rasterize])[graphics,"Image"] to rasterize graphics.

(RefLink[Image, paclet:ref/Image])[(RefLink[Raster, paclet:ref/Raster])[…]] converts a (RefLink[Raster, paclet:ref/Raster]) object to an image.

(RefLink[Image, paclet:ref/Image])[Image[…],opts] effectively resets the options for an image.

(RefLink[ImageDimensions, paclet:ref/ImageDimensions]), (RefLink[ImageChannels, paclet:ref/ImageChannels]) and (RefLink[ImageType, paclet:ref/ImageType]) find information on the structure of an image.

Arithmetic and statistical operations such as (RefLink[Log, paclet:ref/Log]), (RefLink[Plus, paclet:ref/Plus]) and (RefLink[Mean, paclet:ref/Mean]) can work directly with images.

(RefLink[Information, paclet:ref/Information]) for (RefLink[Image, paclet:ref/Image]) may include the following properties:

OpenersPrimaryExamplesSection(Spacer1)Examples  (50)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Create an image from a 3×3 array:

Image[(({{0.1, 0.2, 0.3}, {0.4, 0.5, 0.6}, {0.7, 0.7, 0.9}}))]

Create an RGB channel image from a 3D array:

Image[(({{(({{0}, {0.6}, {0}})), (({{0.4}, {0.1}, {0.8}})), (({{0.7}, {0.9}, {0.7}}))}, {(({{1}, {0}, {0.9}})), (({{0.6}, {0.6}, {1}})), (({{1}, {0.8}, {0.3}}))}})),ColorSpace->"RGB"]

Create an image by importing from a file:

Import["ExampleData/spikey.tiff"]

OpenersExampleSection1(Spacer1)Scope  (19)

OpenersExampleSubsection0(Spacer1)Basic Uses  (3)

Import an image:

Import["ExampleData/rose.gif"]

Change the image type from 8-bit integer to a 64-bit real:

i=;

res=Image[i,"Real64"]

ImageType/@{i,res}

Convert a graphic to a bitmap image:

Image[Plot[{Sin[x],Sin[2x]},{x,0,2π},ImageSize->200]]

OpenersExampleSubsection1(Spacer1)Creating an Image  (12)

Import from a file:

Import["ExampleData/girlcloseup.jpg",ImageSize->100]

Create from a region:

RegionImage[Annulus[]]

Create a grayscale image from a 2D array of data:

Image[(({{0.6, 0.5, 0.5, 0.1}, {0.2, 0.6, 0.6, 0.9}, {0.1, 0.8, 0.4, 0.2}, {0.7, 0.5, 0.1, 0.5}}))]

By default, data is assumed to be 0 to 1 and an image of type "Real64" is generated:

ImageType[%]

Create a color image from a 3D array of data:

Image[RandomReal[1,{4,5,3}]]

Create an image from an array of colors:

Image[{{Red,Green},{Blue,Black}}]

By default, when creating images from data, an image of type "Real64" is generated:

Image[(({{0.6, 0.5, 0.5, 0.1}, {0.2, 0.6, 0.6, 0.9}, {0.1, 0.8, 0.4, 0.2}, {0.7, 0.5, 0.1, 0.5}}))]

ImageType[%]

Create an image of type "Byte":

Image[(({{85, 15, 126, 143}, {238, 86, 225, 199}, {149, 211, 232, 124}, {130, 6, 102, 140}})),"Byte"]

Create a binary image from a 3×3 array:

Image[(({{0, 1, 0}, {1, 0, 1}, {0, 1, 0}})),"Bit"]

Create an image from a (RefLink[SparseArray, paclet:ref/SparseArray]) object:

Image[SparseArray[{{2,3},{4,2}}->1,{5,5}]]

Create a raster image from a (RefLink[Graphics, paclet:ref/Graphics]) object:

Image[Plot[Sin[x],{x,0,2π},ImageSize->200]]

Head[%]

Create an image from a (RefLink[Graphics3D, paclet:ref/Graphics3D]) object:

Image[Graphics3D[Sphere[],ImageSize->200]]

Head[%]

Create an image from a (RefLink[GeoGraphics, paclet:ref/GeoGraphics]) object:

Image[GeoGraphics[GeoRange->"World",ImageSize->200]]

Head[%]

OpenersExampleSubsection2(Spacer1)Arithmetic & Statistical Operations  (4)

Create a linear combination of two images:

0.4×+0.6

Highlight edges in an image:

img=;

img-EdgeDetect[img]

Compute statistical measures on images:

stats={Total,Min, Max,Mean,Median,StandardDeviation};Dataset[AssociationThread[Text/@stats->Through[stats[]]]]

The value of a system option "IndeterminateValue" is used to replace values that cannot be stored in an image including (RefLink[ComplexInfinity, paclet:ref/ComplexInfinity]) and (RefLink[Indeterminate, paclet:ref/Indeterminate]).

By default, 0 is used:

SystemOptions["ImageProcessingOptions"->"IndeterminateValue"]

See the behavior using power:

data= {{0,1,2,3}};
img=Image[data];

(data^data)

(img^img)//ImageData

Change the current value of the "IndeterminateValue" option:

SetSystemOptions["ImageProcessingOptions"->"IndeterminateValue"->100];

(img^img)//ImageData

Reset to the default 0:

SetSystemOptions["ImageProcessingOptions"->"IndeterminateValue"->0 ];

OpenersExampleSection2(Spacer1)Options  (18)

OpenersExampleSubsection3(Spacer1)ColorSpace  (8)

By default, when generating images from data, no specific color space is assumed:

Image[RandomReal[1,{8,10}]]

Check for the color space of an image with (RefLink[ImageColorSpace, paclet:ref/ImageColorSpace]):

ImageColorSpace[%]

Specify the color space:

Image[RandomReal[1,{8,10}],ColorSpace->"Grayscale"]

ImageColorSpace[%]

Generate a random RGB color image:

Image[RandomReal[1,{8,12,3}],ColorSpace->"RGB"]

Random RGB image with alpha channel:

Image[RandomReal[1,{8,12,4}],ColorSpace->"RGB"]

Generate a random gray-level image:

Image[RandomReal[1,{8,12}],ColorSpace->"Graylevel"]

Random gray-level image with alpha channel:

Image[RandomReal[1,{8,12,2}],ColorSpace->"Graylevel"]

Random CMYK image:

Image[RandomReal[1,{8,10,4}],ColorSpace->"CMYK"]

A CIE XYZ image:

Image[RandomReal[1,{8,10,3}],ColorSpace->"XYZ"]

Images with an arbitrary number of channels are stored with (RefLink[ColorSpace, paclet:ref/ColorSpace])->(RefLink[Automatic, paclet:ref/Automatic]):

i=Image[RandomReal[1,{8,10,12}]]

ImageColorSpace[i]

ImageChannels[i]

Image channels should match the number of channels expected by the color space:

Image[RandomReal[1,{2,3}],ColorSpace->"RGB"]

Change the interpretation of the pixel values in an image:

Image[,ColorSpace->"HSB"]

Use (RefLink[ColorConvert, paclet:ref/ColorConvert]) to convert the pixel values to a new space:

ColorConvert[,"HSB"]

OpenersExampleSubsection4(Spacer1)ImageSize  (3)

Image with an explicit setting for the width:

Image[RandomReal[1,{8,12,3}],ImageSize->100]

With (RefLink[ImageSize, paclet:ref/ImageSize])->(RefLink[Automatic, paclet:ref/Automatic]), images may appear larger or smaller than their actual size:

Table[RandomImage[1,{1,1}(2^n),ImageSize->Automatic],{n,8}]

Use (RefLink[ImageSize, paclet:ref/ImageSize])->(RefLink[All, paclet:ref/All]) to see images in their actual size:

Table[RandomImage[1,{1,1}(2^n),ImageSize->All],{n,8}]

Set the displayed size of an image:

Image[,ImageSize->300]

Specifying both width and height will add white space if aspect ratios do not match:

Image[,ImageSize->{300,300}]//Framed

OpenersExampleSubsection5(Spacer1)Interleaving  (3)

By default, interleaved data is assumed:

i=Image[RandomReal[1,{8,12,3}]]

Use (RefLink[Options, paclet:ref/Options]) to extract the (RefLink[Interleaving, paclet:ref/Interleaving]) setting:

Options[i,Interleaving]

ImageDimensions[i]

ImageChannels[i]

Create an image from planar data:

i2=Image[RandomReal[1,{8,12,3}],Interleaving->False]

ImageDimensions[i2]

ImageChannels[i2]

Image with data stored in three color planes:

Image[RandomReal[1,{3,8,12}],Interleaving->False]

Change an interleaved image to planar:

i1=;

i2=Image[i1,Interleaving->False]

Options[#,Interleaving]&/@{i1,i2}

OpenersExampleSubsection6(Spacer1)Magnification  (2)

Image with an explicit magnification:

Image[,Magnification->5]

(RefLink[ImageSize, paclet:ref/ImageSize]) and (RefLink[Magnification, paclet:ref/Magnification]) both control the display size of the image:

i=;

{Image[i,ImageSize->50],Image[i,Magnification->2]}

When both are set, (RefLink[ImageSize, paclet:ref/ImageSize]) specification is used:

Image[i,ImageSize->50,Magnification->2]

OpenersExampleSubsection7(Spacer1)MetaInformation  (2)

Add custom meta-information to an image:

Image[,MetaInformation->{"Owner"->"John"}]

Use (RefLink[Options, paclet:ref/Options]) to extract the meta-information:

Options[%,MetaInformation]

Import puts metadata stored in the file into the (RefLink[MetaInformation, paclet:ref/MetaInformation]) option:

Import["ExampleData/coneflower.jpg"]

Options[%,MetaInformation]

OpenersExampleSection3(Spacer1)Applications  (2)

Visualize an evaluation of a cellular automaton using a binary image:

Image[CellularAutomaton[30,{{1},0},40],"Bit",Magnification->2]

Visualize an elevation map:

Image[QuantityMagnitude[GeoElevationData[(Entity["Denver", Entity["City",{"Denver","Colorado","UnitedStates"}], "Entity[\"City\", {\"Denver\", \"Colorado\", \"UnitedStates\"}]", "city"])]],Magnification->2]//ImageAdjust

OpenersExampleSection4(Spacer1)Properties & Relations  (8)

(RefLink[Image, paclet:ref/Image]) objects are atoms and cannot be subdivided:

AtomQ[]

All values below 0 display as black, and values greater than 1 display as white:

Image[{Range[-.5,1.5,.2]},Magnification->15]//Framed

For images with out-of-range values, use (RefLink[ImageAdjust, paclet:ref/ImageAdjust]) to scale all values between 0 and 1:

ImageAdjust[Image[{Range[-.5,1.5,.2]},Magnification->15]]//Framed

Different image types use different bit depths. Use smaller bit depth for compression:

i=;

ImageType[i]

ByteCount/@Table[Image[i,t],{t,{"Byte","Bit16","Real32","Real64"}}]

Convert a binary image to array rules:

ArrayRules[ImageData[Image[{{0,1},{1,0}}, "Bit"]]]

Use (RefLink[Rasterize, paclet:ref/Rasterize]) to create an image from any expression:

Rasterize[x+y]

Head[%]

Use (RefLink[RandomImage, paclet:ref/RandomImage]) to create an (RefLink[Image, paclet:ref/Image]) with random pixel values:

RandomImage[1,{10,10},ColorSpace->"RGB"]

(RefLink[ConstantImage, paclet:ref/ConstantImage]) can generate an (RefLink[Image, paclet:ref/Image]) of a constant color:

ConstantImage[Cyan,{50,50}]

(RefLink[LinearGradientImage, paclet:ref/LinearGradientImage]) and (RefLink[RadialGradientImage, paclet:ref/RadialGradientImage]) can be used to create gradient images:

LinearGradientImage[{{Left,Bottom},{Right,Top}}->"Rainbow",{50,50}]

RadialGradientImage["Rainbow",{50,50}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ImageQ, paclet:ref/ImageQ])  ▪  (RefLink[DynamicImage, paclet:ref/DynamicImage])  ▪  (RefLink[Graphics, paclet:ref/Graphics])  ▪  (RefLink[Raster, paclet:ref/Raster])  ▪  (RefLink[ArrayPlot, paclet:ref/ArrayPlot])  ▪  (RefLink[Import, paclet:ref/Import])  ▪  (RefLink[Rasterize, paclet:ref/Rasterize])  ▪  (RefLink[ImageData, paclet:ref/ImageData])  ▪  (RefLink[ImagePyramid, paclet:ref/ImagePyramid])  ▪  (RefLink[Image3D, paclet:ref/Image3D])  ▪  (RefLink[ImageDimensions, paclet:ref/ImageDimensions])  ▪  (RefLink[Binarize, paclet:ref/Binarize])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Image Processing, paclet:tutorial/ImageProcessing])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Image Processing & Analysis, paclet:guide/ImageProcessing])}, {▪(RefLinkPlain[Image Representation, paclet:guide/ImageRepresentation])}, {▪(RefLinkPlain[Creating & Importing Images, paclet:guide/CreatingAndImportingImages])}, {▪(RefLinkPlain[WDF (Wolfram Data Framework), paclet:guide/WDFWolframDataFramework])}, {▪(RefLinkPlain[Form Structure & Layout, paclet:guide/FormStructureAndLayout])}, {▪(RefLinkPlain[Scientific Data Analysis, paclet:guide/ScientificDataAnalysis])}, {▪(RefLinkPlain[Wolfram Data Repository, paclet:guide/WolframDataRepository])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/2nd-ed/10-images.html])(WebLink[: Images, https://www.wolfram.com/language/elementary-introduction/2nd-ed/10-images.html])}})}})