Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)


changes the pixel values at pixel position ppos in image to val.

assumes val to be of the specified type.


  • 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 specification
    markerimagea marker image
  • In ReplacePixelValue[image,{xp,yp}->val], the pixel position with assumed to be in the standard image coordinate system, where the values of x range from to width and y from to height.
  • In ReplacePixelValue, 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.
  • The pixel value val can be a scalar, a list of channel values, or a color.
  • ReplacePixelValue[image,{ppos1->val1,}] can be used to set pixel values for multiple positions.
  • When the pixel position ppos lies on a boundary between pixels, all adjacent pixels are modified.
  • ReplacePixelValue typically gives an image that has the same type as image.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Set a pixel in an image:

Click for copyable input

Unset a pixel to separate connected components:

Click for copyable input

Set a pixel in the top-left front corner of a 3D image to gray:

Click for copyable input
Introduced in 2012
| Updated in 2014