gives the pixel value of image at position pos.


gives the pixel value converted to the specified type.

Details and Options

  • Pixel positions ppos can be in one of the following forms:
  • {x,y}or {x,y,z}single position in 2D or 3D
    {xmin;;xmax,}span of positions
    {ppos1,ppos2,}a list of position specifications
    markerimagea marker image
  • In PixelValue[image,{xp,yp}], the pixel position {xp,yp}={x+1/2,y+1/2}, with {x,y} assumed to be in the standard image coordinate system, where the values of x range from 0 to width and y from 0 to height.
  • In PixelValue, integer coordinates correspond to the centers of the pixels. In 2D, pixel position represents the center of the bottom-left pixel. In 3D, pixel position corresponds to the center of the bottom-left front pixel.
  • PixelValue gives the value of the pixel nearest to {xp,yp}, except that when the position {xp,yp} lies on a boundary between pixels, the average of the pixels surrounding {xp,yp} is returned.
  • Use ImageValue to extract interpolated values at {x,y} in the standard image coordinate system.
  • With PixelValue[image,marker], nonzero pixels of the image marker are used as the list of positions.
  • PixelValue[image,ppos] by default returns values between 0 and 1. Using PixelValue[image,ppos,"type"], pixel value is returned in the range specified by "type". See the reference page for Image for a list of all possible data types.
  • PixelValue[image,ppos,Automatic] is equivalent to PixelValue[image,ppos,ImageType[image]].
  • PixelValue can take a Padding option that is used when a specified position is beyond an image.


open allclose all

Basic Examples  (3)

Value of the bottom-left corner pixel:

Click for copyable input

Pixel value in "Byte" type:

Click for copyable input

Value of a bottom-left front corner pixel in a 3D volume:

Click for copyable input

Scope  (7)

Applications  (2)

Properties & Relations  (2)

Possible Issues  (2)

Interactive Examples  (1)

See Also

ImageValue  ReplacePixelValue  PixelValuePositions  ImageData  Image  Image3D

Introduced in 2010
| Updated in 2014