({{, (RefLink[ImageValue, paclet:ref/ImageValue])[image,pos] 
gives the pixel value of image at position pos.}, {, (RefLink[ImageValue, paclet:ref/ImageValue])[image,pos,"type"]
gives the pixel value converted to the specified type.}})

OpenersNotesSection(Spacer1)Details and Options

Pixel positions pos can be in one of the following forms:

(RefLink[ImageValue, paclet:ref/ImageValue]) assumes the standard image coordinate system.

Use (RefLink[PixelValue, paclet:ref/PixelValue]) to use integer indices for extracting exact pixel values of the image.

(RefLink[ImageValue, paclet:ref/ImageValue])[image,pos] by default returns values between 0 and 1. Using (RefLink[ImageValue, paclet:ref/ImageValue])[image,pos,"type"], a pixel value is returned in the range specified by "type". See the reference page for (RefLink[Image, paclet:ref/Image]) for a list of all possible data types.

(RefLink[ImageValue, paclet:ref/ImageValue])[image,pos,(RefLink[Automatic, paclet:ref/Automatic])] is equivalent to (RefLink[ImageValue, paclet:ref/ImageValue])[image,pos,(RefLink[ImageType, paclet:ref/ImageType])[image]].

The following options can be given:

Possible settings for (RefLink[DataRange, paclet:ref/DataRange]) include:

With (RefLink[Resampling, paclet:ref/Resampling])->"Nearest", when the position pos lies on a boundary between pixels, the average of the pixels surrounding pos is returned. »

OpenersPrimaryExamplesSection(Spacer1)Examples  (14)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Value of a pixel in a color image:

ImageValue[, {100,100}]

Image value in "Byte" type:

ImageValue[, {100,100},"Byte"]

Image value of a 3D volume:

ImageValue[, {0.5,0.5,2.5}]

OpenersExampleSection1(Spacer1)Scope  (3)

Extract the raw pixel value in the underlying data type:

ImageValue[,{10,90},Automatic]

Pixel values of multiple positions:

ImageValue[,{{10,90},{100,100}}]

Pixel values of a range of positions:

ImageValue[,{10;;15,50;;51}]

OpenersExampleSection2(Spacer1)Options  (3)

OpenersExampleSubsection0(Spacer1)DataRange  (1)

Pixel value at the center of an image using a normalized data range:

ImageValue[, {1/2,1/2},DataRange->{{0,1},{0,1}}]

OpenersExampleSubsection1(Spacer1)Padding  (1)

By default pixels outside of an image are assumed to be zero:

ImageValue[,Table[{i,i},{i,0.5,10,1}]]

Specify a padding scheme:

ImageValue[,Table[{i,i},{i,0.5,10,1}],Padding->"Periodic"]

OpenersExampleSubsection2(Spacer1)Resampling  (1)

Bilinear subpixel interpolation:

ImageValue[Image[{{0,.1},{.2,.3}}],{.9,.9}]

Using the nearest value instead of interpolating:

ImageValue[Image[{{0,.1},{.2,.3}}],{.9,.9},Resampling->"Nearest"]

OpenersExampleSection3(Spacer1)Applications  (1)

Get values of the diagonal pixels:

ImageValue[,Table[{i,i},{i,.5,10,1}]]

OpenersExampleSection5(Spacer1)Possible Issues  (3)

With (RefLink[Resampling, paclet:ref/Resampling])->"Nearest" and integer coordinates, the average of the pixels surrounding the specified coordinate is returned:

ImageValue[,{1,1},Resampling->"Nearest"]

When converting to "Bit" type, pixel values will get rounded:

ImageValue[,{1.5,1.5}]

ImageValue[,{1.5,1.5},"Bit"]

Extracting value at multiple positions is much faster if done at once rather than extracting one at a time:

img = ;
coordinates = ImageValuePositions[img, Green, 0.6];

AbsoluteTiming[r1=ImageValue[img, coordinates];]

AbsoluteTiming[r2=Table[ImageValue[img,point],{point,coordinates}];]

r1===r2

OpenersExampleSection6(Spacer1)Interactive Examples  (1)

Profile of a single image row:

With[{img=},Manipulate[ListLinePlot[ImageValue[img,{All,row}],PlotRange->{0,1}],{row,0.5,150-0.5,1}]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ReplaceImageValue, paclet:ref/ReplaceImageValue])  ▪  (RefLink[ImageValuePositions, paclet:ref/ImageValuePositions])  ▪  (RefLink[PixelValue, paclet:ref/PixelValue])  ▪  (RefLink[ImageData, paclet:ref/ImageData])  ▪  (RefLink[Image, paclet:ref/Image])  ▪  (RefLink[Image3D, paclet:ref/Image3D])  ▪  (RefLink[ImageLevels, paclet:ref/ImageLevels])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Basic Image Manipulation, paclet:guide/BasicImageManipulation])}, {▪(RefLinkPlain[Color Processing, paclet:guide/ColorProcessing])}, {▪(RefLinkPlain[Image Representation, paclet:guide/ImageRepresentation])}, {▪(RefLinkPlain[Image Processing & Analysis, paclet:guide/ImageProcessing])}})}})