Wolfram Language & System 11.0 (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 position pos in image to val.

assumes val to be of the specified type.

Details and OptionsDetails and Options

  • Pixel positions pos 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
    {pos1,pos2,}a list of position specifications
    markerimagea marker image
  • ReplaceImageValue by default assumes the standard image coordinate system.
  • Other coordinate systems can be specified by setting the DataRange option. Typical settings include:
  • Automatic{{0,1},{0,h/w}} in 2D, {{0,1},{0,d/w},{0,h/w}} in 3D
    Full{{0,w},{0,h}} in 2D, {{0,1},{0,d},{0,h}} in 3D (default)
    {{left,right},{bottom,top}}explicit coordinate ranges in 2D
    {{left,right},{front,back},{bottom,top}}explicit coordinate ranges in 3D
  • Use ReplacePixelValue to specify exact pixel positions with integer indices.
  • The pixel value val can be a scalar, a list of channel values, or a color.
  • ReplaceImageValue[image,{pos1->val1,}] can be used to set pixel values for multiple positions.
  • When a position pos lies on a boundary between pixels, all adjacent pixels are modified.
  • ReplaceImageValue typically gives an image that has the same type as image.

ExamplesExamplesopen allclose all

Basic Examples  (4)Basic Examples  (4)

Set a pixel in the center of the eye to white:

Click for copyable input

Set a list of pixels to black:

Click for copyable input

Set a list of pixels to a list of colors:

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